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

x/tools/go/packages: packages.Load: internal error: go list gives conflicting information for package #47065

Open
skipor opened this issue Jul 6, 2021 · 2 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@skipor
Copy link

skipor commented Jul 6, 2021

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

  $ go version
  go version go1.16.5 darwin/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
  GO111MODULE=""
  GOARCH="amd64"
  GOBIN=""
  GOCACHE="/Users/skipor/Library/Caches/go-build"
  GOENV="/Users/skipor/Library/Application Support/go/env"
  GOEXE=""
  GOFLAGS=""
  GOHOSTARCH="amd64"
  GOHOSTOS="darwin"
  GOINSECURE=""
  GOMODCACHE="/Users/skipor/dev/pkg/mod"
  GONOPROXY=""
  GONOSUMDB=""
  GOOS="darwin"
  GOPATH="/Users/skipor/dev"
  GOPRIVATE=""
  GOPROXY="https://proxy.golang.org,direct"
  GOROOT="/usr/local/Cellar/go/1.16.5/libexec"
  GOSUMDB="sum.golang.org"
  GOTMPDIR=""
  GOTOOLDIR="/usr/local/Cellar/go/1.16.5/libexec/pkg/tool/darwin_amd64"
  GOVCS=""
  GOVERSION="go1.16.5"
  GCCGO="gccgo"
  AR="ar"
  CC="clang"
  CXX="clang++"
  CGO_ENABLED="1"
  GOMOD="/Users/skipor/dev/src/github.com/skipor/load-fail-reproduce/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/mz/302r6kfj32n58s3kyn9xzv10lwc0b0/T/go-build1364070689=/tmp/go-build -gno-record-gcc-switches -fno-common"
  

What did you do?

Run packages.Load on packages a and b where b/b.go imports a, a/a.go imports b, but a/a_test.go imports nothing.
Runnable, detailed example:

git clone https://github.com/skipor/golang-x-tools-packages-load-fail-reproduce
cd golang-x-tools-packages-load-fail-reproduce
./reproduce.sh

What did you expect to see?

packages.Load returns []packages.Package where for package a packages.Pacakge.Errors contains errors like:

- import cycle not allowed: import stack: [a b a]
- a/a.go:4:2: could not import b (import cycle: [b a])

Like it happen, when there is no a/*_test.go files, or they imports b

What did you see instead?

packages.Load returns error internal error: go list gives conflicting information for package a [a.test]

Relates to #43821

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Jul 6, 2021
@gopherbot gopherbot added this to the Unreleased milestone Jul 6, 2021
@skipor skipor changed the title x/tools/go/packages: internal error: go list gives conflicting information for package x/tools/go/packages: packages.Load: internal error: go list gives conflicting information for package Jul 6, 2021
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 7, 2021
@mknyszek
Copy link
Contributor

mknyszek commented Jul 7, 2021

@gopherbot
Copy link

Change https://go.dev/cl/500835 mentions this issue: go/packages: Print a more useful error on cycle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants