Skip to content

x/tools/gopls: renaming test file package declaration package_test -> package falsely claims import cycle #45317

Closed
@soypat

Description

@soypat

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/[email protected] 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/metadataIssues related to metadata loading in gopls

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions