Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
libotony committed Jul 26, 2024
1 parent 8d8dd82 commit 37514b6
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions internal/build/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func CopyFile(dst, src string, mode os.FileMode) {
// so that go commands executed by build use the same version of Go as the 'host' that runs
// build code. e.g.
//
// /usr/lib/go-1.8/bin/go run build/ci.go ...
// /usr/lib/go-1.8/bin/go run build/ci.go ...
//
// runs using go 1.8 and invokes go 1.8 tools from the same GOROOT. This is also important
// because runtime.Version checks on the host should match the tools that are run.
Expand All @@ -163,12 +163,22 @@ func ExpandPackagesNoVendor(patterns []string) []string {
}
if expand {
cmd := GoTool("list", patterns...)
out, err := cmd.CombinedOutput()
var (
stdout bytes.Buffer
stderr bytes.Buffer
)
cmd.Stdout = &stdout
cmd.Stderr = &stderr
err := cmd.Run()
if err != nil {
log.Fatalf("package listing failed: %v\n%s", err, string(out))
log.Fatalf("package listing failed: %v\n", err)
}

fmt.Println(">>> go list STDOUT", string(stdout.Bytes()))
fmt.Println(">>> go list STDERR", string(stderr.Bytes()))

var packages []string
for _, line := range strings.Split(string(out), "\n") {
for _, line := range strings.Split(string(stdout.Bytes())+string(stderr.Bytes()), "\n") {
if !strings.Contains(line, "/vendor/") {
packages = append(packages, strings.TrimSpace(line))
}
Expand Down

0 comments on commit 37514b6

Please sign in to comment.