Skip to content

cmd/go: go list reports all dependencies as indirect with workspaces #66789

Closed
@CHC383

Description

@CHC383

Go version

go version go1.22.2 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/xxx/Library/Caches/go-build'
GOENV='/Users/xxx/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/xxx/go/pkg/mod'
GONOPROXY='bitbucket.org/labscale'
GONOSUMDB='bitbucket.org/labscale'
GOOS='darwin'
GOPATH='/Users/xxx/go'
GOPRIVATE='bitbucket.org/labscale'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.22.2/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.2/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/wc/l5mz01h92p58tgq77kn1c6pr0000gn/T/go-build1746990975=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Tried to run go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m xxx to get the direct dependencies of one module on a workspace with multiple modules

What did you see happen?

The command outputs nothing, i.e. all direct dependencies of the module are discovered as indirect dependencies

What did you expect to see?

The command should show the direct dependencies of the module

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions