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

Open
soypat opened this issue Mar 31, 2021 · 1 comment

Comments

@soypat
Copy link

@soypat 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.

@soypat
Copy link
Author

@soypat 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 this to the Unreleased milestone Mar 31, 2021
@stamblerre stamblerre removed this from the Unreleased milestone Apr 1, 2021
@stamblerre stamblerre added this to the gopls/v1.0.0 milestone 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants