// list runs 'go list' with the specified arguments and returns the metadata
// for matching packages.
list runs 'go list' with the specified arguments and returns the metadata
for matching packages.
// list runs ' go list ' with the specified arguments and returns the metadata // for matching packages .
func list(args ...string) ([]*build.Package, error) {
	cmd := exec.Command("go", append([]string{"list", "-e", "-json"}, args...)...)
	cmd.Stdout = new(bytes.Buffer)
	if err := cmd.Run(); err != nil {
		return nil, err
	}
	dec := json.NewDecoder(cmd.Stdout.(io.Reader))
	var pkgs []*build.Package
	for {
		var p build.Package
		if err := dec.Decode(&p); err == io.EOF {
			break
		} else if err != nil {
			return nil, err
		}
		pkgs = append(pkgs, &p)
	}
	return pkgs, nil
}
func list ( args ... string ) ( [ ] * build . Package , error ) { cmd := exec . Command ( " " , append ( [ ] string { " " , " " , " " } , args ... ) ... ) cmd . Stdout = new ( bytes . Buffer ) if err := cmd . Run ( ) ; err != nil { return nil , err } dec := json . NewDecoder ( cmd . Stdout . ( io . Reader ) ) var pkgs [ ] * build . Package for { var p build . Package if err := dec . Decode ( & p ) ; err == io . EOF { break } else if err != nil { return nil , err } pkgs = append ( pkgs , & p ) } return pkgs , nil }
list runs 'go list' with the specified arguments and returns the metadata
for matching packages.
list runs ' go list ' with the specified arguments and returns the metadata for matching packages .