-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
What version of Go are you using (go version
)?
$ go version go version devel +73d213708e Sat Jan 25 16:34:18 2020 +0000 linux/amd64 $ go list -m golang.org/x/tools golang.org/x/tools v0.0.0-20200124220429-8fe064f891f2 $ go list -m golang.org/x/tools/gopls golang.org/x/tools/gopls v0.1.8-0.20200124220429-8fe064f891f2
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="on" GOARCH="amd64" GOBIN="" GOCACHE="/home/myitcv/.cache/go-build" GOENV="/home/myitcv/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/myitcv/gostuff" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/myitcv/gos" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/myitcv/gostuff/src/github.com/myitcv/govim/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 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build059125969=/tmp/go-build -gno-record-gcc-switches"
What did you do?
This is somewhat similar to #36661
We have just added a new govim
test that seeks to verify diagnostics are as expected where initially empty .go
files exist on disk, but changes to populate those files are then made (but not saved) within the editor.
Like #36661, the scenario involves creating a package p with a simple function DoIt. p is imported by a main package. p also has a test file that exercises DoIt, and an external test file that does the same.
Initially all call sites for DoIt incorrectly pass an integer argument, meaning we should have error diagnostics for all call sites. Then we correct the definition of DoIt to take an integer argument at which point all diagnostics should disappear.
The test can be seen here:
What did you expect to see?
The diagnostic error:
cannot convert 5 (untyped int constant) to string
for each of the files main.go
, p/x_test.go
and p/p_test.go
What did you see instead?
Random results
- Sometimes we are missing any diagnostics for
main.go
- Sometimes we get
package p; expected p_test
forp/p.go
- Sometimes we get
"could not import mod.com/p (no parsed files for package mod.com/p, expected: [], errors: [], list errors: [-: p/p.go:1:1: expected 'package', found 'EOF'])
forp/x_test.go
One such gopls
log file:
gopls.log
Tentatively marking as v0.3.0
cc @stamblerre
FYI @leitzler