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/gopls: renaming test file package declaration package_test -> package falsely claims import cycle #45317

Closed
soypat opened this issue Mar 31, 2021 · 3 comments
Labels
gopls/metadata gopls Tools
Milestone

Comments

@soypat
Copy link

soypat commented Mar 31, 2021

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

$ go version
go version go1.16.2 linux/amd64
$ gopls version
golang.org/x/tools/gopls v0.6.9
    golang.org/x/tools/gopls@v0.6.9 h1:LBBcE2y3Tb4bp79JVLWCQBbvYCFEs5ADGWsQDoSLk1Q=

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/pato/go/bin"
GOCACHE="/home/pato/.cache/go-build"
GOENV="/home/pato/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/pato/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/pato/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="/home/pato/src/godesim/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1047604572=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Renamed a *_test.go file package declaration from package godesim_test to package godesim

What did you expect to see?

All good, package renamed. No biggie.

What did you see instead?

Gopls insisted there was an import cycle, even after removing the import ( "godesim" ) statement. After restarting gopls this did not persist. I've been able to reproduce it on several packages.

@gopherbot gopherbot added the gopls label Mar 31, 2021
@soypat
Copy link
Author

soypat commented Mar 31, 2021

The problem seems to happen when there are other files with package_test package declaration who import the base package.

@seankhliao seankhliao changed the title gopls Renaming test file package declaration package_test -> package falsely claims import cycle x/tools/gopls: Renaming test file package declaration package_test -> package falsely claims import cycle Mar 31, 2021
@gopherbot gopherbot added the Tools label Mar 31, 2021
@gopherbot gopherbot added this to the Unreleased milestone Mar 31, 2021
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v1.0.0 Apr 1, 2021
@stamblerre stamblerre added this to To Do in gopls on-deck Apr 15, 2021
@stamblerre stamblerre changed the title x/tools/gopls: Renaming test file package declaration package_test -> package falsely claims import cycle x/tools/gopls: renaming test file package declaration package_test -> package falsely claims import cycle Jun 28, 2021
@stamblerre stamblerre moved this from To Do to P2 in gopls on-deck Aug 12, 2021
@findleyr findleyr added the gopls/metadata label May 10, 2022
@findleyr
Copy link
Contributor

findleyr commented May 10, 2022

I believe this is now fixed, along with #52500, but it warrants confirmation.

@findleyr findleyr modified the milestones: gopls/later, gopls/v0.9.0 May 20, 2022
@findleyr
Copy link
Contributor

findleyr commented May 23, 2022

I've confirmed that this is now resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/metadata gopls Tools
Projects
No open projects
Development

No branches or pull requests

4 participants