aboutsummaryrefslogtreecommitdiff
path: root/cmd/internal
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2024-07-24 16:44:13 -0400
committerGopher Robot <gobot@golang.org>2024-07-24 21:23:07 +0000
commit557c002897fca2516fc696a6a39fa978ff5a719a (patch)
tree2591ea149bc0ff527805d3b40f051ba8cb57b17c /cmd/internal
parent3166cf6ec5e3af8c30b0603cfacb51e193c87d9b (diff)
downloadgo-x-pkgsite-557c002897fca2516fc696a6a39fa978ff5a719a.tar.xz
cmd/pkgsite: fix setting gorepo flag
The value of the gorepo flag variable was being used before flags were parsed. Fix that. Also fix a couple of other issues that came up in golang/go#68533: First, don't print "searching GOPATH" when we're not searching GOPATH. Second, print the stderr from the go command in the error when it fails because it's the stderr that usually provides information about the failure, not the stdout. For golang/go#68533 Change-Id: Ic6321d6e071dd82415474f2a2c54146e9eabbef7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/600917 Reviewed-by: Jonathan Amsterdam <jba@google.com> Auto-Submit: Michael Matloob <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'cmd/internal')
-rw-r--r--cmd/internal/pkgsite/server.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/internal/pkgsite/server.go b/cmd/internal/pkgsite/server.go
index aa57f404..14356837 100644
--- a/cmd/internal/pkgsite/server.go
+++ b/cmd/internal/pkgsite/server.go
@@ -71,7 +71,7 @@ func BuildServer(ctx context.Context, serverCfg ServerConfig) (*frontend.Server,
var err error
cfg.dirs, err = getModuleDirs(ctx, serverCfg.Paths)
if err != nil {
- return nil, fmt.Errorf("searching GOPATH: %v", err)
+ return nil, fmt.Errorf("searching modules: %v", err)
}
}
@@ -332,6 +332,9 @@ func runGo(dir string, args ...string) ([]byte, error) {
cmd.Dir = dir
out, err := cmd.Output()
if err != nil {
+ if ee, ok := err.(*exec.ExitError); ok {
+ out = append(out, ee.Stderr...)
+ }
return nil, fmt.Errorf("running go with %q: %v: %s", args, err, out)
}
return out, nil