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

Open
myitcv opened this issue Nov 6, 2018 · 2 comments · May be fixed by #59025
Open

cmd/go: go list -m -json output changes if module version supplied #28612

myitcv opened this issue Nov 6, 2018 · 2 comments · May be fixed by #59025
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@myitcv
Copy link
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 myitcv added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go modules labels Nov 6, 2018
@myitcv
Copy link
Member Author

myitcv commented Nov 6, 2018

cc @bcmills

@bcmills bcmills added this to the Go1.13 milestone Nov 16, 2018
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
ChandanChainani added a commit to ChandanChainani/go that referenced this issue Mar 14, 2023
@gopherbot
Copy link

Change https://go.dev/cl/476018 mentions this issue: cmd/go/list: fix missing Indirect in module listing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants