Skip to content

x/tools/gopls: format_on_save_new_file (govim) test flaky #36772

@myitcv

Description

@myitcv

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-build728174989=/tmp/go-build -gno-record-gcc-switches"

What did you do?

As a follow up to #34103 (comment), we are seeing some errors being logged by gopls when we are not expecting any.

As background, in govim/govim#661 we are looking to enable an automatic check at the end of each integration test, a check that asserts we have received no errors/warnings from gopls (this check will not be in place for tests where we are expecting errors/warnings).

For example we have a test that ensures CodeAction and Formatting work on a buffer that does not yet exist on disk.

In the test we sometimes see the following error message:

[Trace - 02:34:55.311 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2020/01/26 02:34:55 diagnose: could not generate diagnostics for package: no parsed files for package command-line-arguments, expected: [/artefacts/govim/cmd/govim/scenario_default/script-format_on_save_new_file/main.go], errors: [successfully parsed but no token.File for file:///artefacts/govim/cmd/govim/scenario_default/script-format_on_save_new_file/main.go (/artefacts/govim/cmd/govim/scenario_default/script-format_on_save_new_file/main.go:1:2: expected ';', found 'EOF' (and 2 more errors))], list errors: []\n\tpackage = command-line-arguments"}

The gopls log file for this test run is: gopls.log

It is true that no files exist, but this test is run within the context of a main module.

What did you expect to see?

No errors logged.

What did you see instead?

As above.

Tentatively marking as v0.3.0. I will also add further instances of logged errors as CI finds them.


cc @stamblerre

FYI @leitzler

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions