From 43b56cbaf3f1de1d1ad379055ab1de157592cf38 Mon Sep 17 00:00:00 2001 From: Ben Kraft Date: Wed, 15 Sep 2021 14:18:27 -0700 Subject: [PATCH] Forward `go mod tidy` stdout/stderr This is a command that can fail (in my case I think for stupid reasons in a hell of my own construction, but nonetheless). Right now we just get ``` $ go run github.com/Khan/webapp/dev/cmd/gqlgen tidy failed: go mod tidy failed: exit status 1 exit status 3 ``` which is not the most informative. Now, instead, we'll forward its output to our own stdout/stderr rather than devnull. --- internal/code/packages.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/code/packages.go b/internal/code/packages.go index 39ba374eab6..17d59f42c91 100644 --- a/internal/code/packages.go +++ b/internal/code/packages.go @@ -4,6 +4,7 @@ import ( "bytes" "errors" "fmt" + "os" "os/exec" "path/filepath" @@ -155,6 +156,8 @@ func (p *Packages) Evict(importPath string) { func (p *Packages) ModTidy() error { p.packages = nil tidyCmd := exec.Command("go", "mod", "tidy") + tidyCmd.Stdout = os.Stdout + tidyCmd.Stderr = os.Stdout if err := tidyCmd.Run(); err != nil { return fmt.Errorf("go mod tidy failed: %w", err) }