From 37514b6da092132ba8471b2be33b7d3e49acc10d Mon Sep 17 00:00:00 2001 From: tony Date: Fri, 26 Jul 2024 14:50:54 +0800 Subject: [PATCH] temp --- internal/build/util.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/internal/build/util.go b/internal/build/util.go index f99ee8396d24..0b3cc85d1495 100644 --- a/internal/build/util.go +++ b/internal/build/util.go @@ -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. @@ -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)) }