Skip to content

cmd/go: go list misattributed error for missing dependency #70654

@nabice

Description

@nabice

Go version

go version go1.23.3 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/nabice/.cache/go-build'
GOENV='/home/nabice/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/nabice/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/nabice/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/ssd/source/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/ssd/source/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.3'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/nabice/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/nabice/temp/go_list_bug/go.mod'
GOWORK='/home/nabice/temp/go_list_bug/go.work'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2242914037=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Repository: github.com/nabice/golistissue
The project contains seven files, and I've reduced the code as much as possible to reproduce the issue.

git clone https://github.com/nabice/golistissue
go list -e -json=Name,ImportPath,Error,DepOnly,Module -compiled=true -test=false -export=true -deps=true -find=false -pgo=off -- ./...

What did you see happen?

{
        "ImportPath": "github.com/pkg/errors",
        "DepOnly": true,
        "Error": {
                "ImportStack": [
                        "github.com/nabice/golistissue/analytics",
                        "github.com/pkg/errors"
                ],
                "Pos": "util/fileutil.go:4:2",
                "Err": "github.com/nabice/errorpkg@v0.9.1: reading github.com/nabice/errorpkg/go.mod at revision v0.9.1: git ls-remote -q origin in /home/nabice/go/pkg/mod/cache/vcs/878721895ab660b96a101659ca17aa7068c22b888997bc7726d86e2caba4f39f: exit status 128:\n\tfatal: could not read Username for 'https://github.com': terminal prompts disabled\nConfirm the import path was entered correctly.\nIf this is a private repository, see https://golang.org/doc/faq#git_https for additional information."
        }
}

What did you expect to see?

The github.com/pkg/errors package should not contain error information, and the package can be found. I tested it with Go 1.17, and the output was correct.

Metadata

Metadata

Assignees

Labels

GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions