Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: make go mod download -json return the exit status 0 in case of errors #36833

Closed
perillo opened this issue Jan 28, 2020 · 6 comments
Closed
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@perillo
Copy link
Contributor

perillo commented Jan 28, 2020

What version of Go are you using (go version)?

$ go version
go version go1.13.6 linux/amd64

Does this issue reproduce with the latest release?

Yes. But at least with go1.14beta1 go mod download -json does not print debug message on stderr.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/manlio/.local/bin"
GOCACHE="/home/manlio/.cache/go-build"
GOENV="/home/manlio/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY="github.com/perillo"
GONOSUMDB="github.com/perillo"
GOOS="linux"
GOPATH="/home/manlio/.local/lib/go:/home/manlio/src/go"
GOPRIVATE="github.com/perillo"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build524871395=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.13.6 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.13.6
uname -sr: Linux 5.4.15-arch1-1
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.30.
gdb --version: GNU gdb (GDB) 8.3.1

What did you do?

go mod download -json github.com/perillo/null
echo $?

In case of errors, the process exit status will be 1, making it more complex to handle the go mod download output.

{
	"Path": "github.com/perillo/null",
	"Error": "module github.com/perillo/null: not a known dependency"
}
1

go mod download -json should return an exit status 0 in case of errors, the same as go list -m -e -json.

@perillo
Copy link
Contributor Author

perillo commented Jan 28, 2020

There is a similar issue in #35380.

However it suggests to change the documentation. I suggest to change the implementation to match go list -m -e -json. In alternative go mod download should support the -e flag.

@perillo
Copy link
Contributor Author

perillo commented Jan 30, 2020

I would like to change the issue title.

I think that go mod download should print on stderr the errors encountered, as with go list -json (without the -e flag).

The reason is that the user can simply print the error returned by Command.Run and the content of stderr, instead of processing all the modules and check the Error field.

@perillo
Copy link
Contributor Author

perillo commented Jan 30, 2020

go mod download has another issue.
The Module.Error field is defined as string instead of *ModuleError as defined in go list -m.
What is the reason for the difference?

@cagedmantis
Copy link
Contributor

@perillo As you mentioned above, there has been a discussion about the original issue mentioned here on #35380. Do you think commenting on that issue would sufficiently help you express your suggested solution?

@cagedmantis cagedmantis added this to the Backlog milestone Feb 7, 2020
@cagedmantis cagedmantis added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Feb 7, 2020
@perillo
Copy link
Contributor Author

perillo commented Feb 7, 2020

Yes, thanks.

@cagedmantis
Copy link
Contributor

Great, thank you. Closing this issue.

@golang golang locked and limited conversation to collaborators Feb 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants