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: go list -m -json output changes if module version supplied #28612

Open
myitcv opened this Issue Nov 6, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@myitcv
Member

myitcv commented Nov 6, 2018

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

$ go version
go version go1.11.1 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN="/home/myitcv/go-modules-by-example/.bin"
GOCACHE="/home/myitcv/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPROXY=""
GORACE=""
GOROOT="/home/myitcv/gos"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/myitcv/go-modules-by-example/go.mod"
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-build283609322=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ git clone https://github.com/myitcvscratch/usenonmod /tmp/usenonmod
Cloning into '/tmp/usenonmod'...
$ cd /tmp/usenonmod
$ git checkout 8f021b7b44b6abe1c2cc18d87e72eb28dd1f6a33
HEAD is now at 8f021b7... Initial commit
$ go mod tidy
go: downloading github.com/myitcvscratch/nonmod v0.0.0-20181105194257-9516961eb10a
go: downloading golang.org/x/tools v0.0.0-20181105194243-ebdbadb46e45
$ go list -m all
github.com/myitcvscratch/usenonmod
github.com/myitcvscratch/nonmod v0.0.0-20181105194257-9516961eb10a
golang.org/x/tools v0.0.0-20181105194243-ebdbadb46e45
$ go list -m -json golang.org/x/tools
{
        "Path": "golang.org/x/tools",
        "Version": "v0.0.0-20181105194243-ebdbadb46e45",
        "Time": "2018-11-05T19:42:43Z",
        "Indirect": true,
        "Dir": "/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20181105194243-ebdbadb46e45",
        "GoMod": "/gopath/pkg/mod/cache/download/golang.org/x/tools/@v/v0.0.0-20181105194243-ebdbadb46e45.mod"
}
$ go list -m -json golang.org/x/tools@v0.0.0-20181105194243-ebdbadb46e45
{
        "Path": "golang.org/x/tools",
        "Version": "v0.0.0-20181105194243-ebdbadb46e45",
        "Time": "2018-11-05T19:42:43Z",
        "Dir": "/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20181105194243-ebdbadb46e45",
        "GoMod": "/gopath/pkg/mod/cache/download/golang.org/x/tools/@v/v0.0.0-20181105194243-ebdbadb46e45.mod"
}

What did you expect to see?

The same output for both go list -m -json commands.

What did you see instead?

The .Indirect field is missing if the version is provided, as in the second call.

@myitcv

This comment has been minimized.

Member

myitcv commented Nov 6, 2018

@bcmills bcmills added this to the Go1.13 milestone Nov 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment