Gopher Robot submitted this change.
gopls/internal/server: print stderr in go mod vendor error message
TestInconsistentVendoring is flaking on Windows with the not-so-helpful
"exit status 1". Include stderr in the error message to help debug.
For golang/go#64229
Change-Id: Iadb946e799e866af683ea9ea7fc039f34b45b1ba
Reviewed-on: https://go-review.googlesource.com/c/tools/+/550375
Auto-Submit: Robert Findley <rfin...@google.com>
Reviewed-by: Bryan Mills <bcm...@google.com>
LUCI-TryBot-Result: Go LUCI <golang...@luci-project-accounts.iam.gserviceaccount.com>
---
M gopls/internal/server/command.go
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/gopls/internal/server/command.go b/gopls/internal/server/command.go
index 333f71c..6696585 100644
--- a/gopls/internal/server/command.go
+++ b/gopls/internal/server/command.go
@@ -386,12 +386,16 @@
// If golang/go#44119 is resolved, go mod vendor will instead modify
// modules.txt in-place. In that case we could theoretically allow this
// command to run concurrently.
+ stderr := new(bytes.Buffer)
err := deps.snapshot.RunGoCommandPiped(ctx, cache.Normal|cache.AllowNetwork, &gocommand.Invocation{
Verb: "mod",
Args: []string{"vendor"},
WorkingDir: filepath.Dir(args.URI.Path()),
- }, &bytes.Buffer{}, &bytes.Buffer{})
- return err
+ }, &bytes.Buffer{}, stderr)
+ if err != nil {
+ return fmt.Errorf("running go mod vendor failed: %v\nstderr:\n%s", err, stderr.String())
+ }
+ return nil
})
}
To view, visit change 550375. To unsubscribe, or for help writing mail filters, visit settings.