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: diagnostics not sent for new buffer #35638

Open
myitcv opened this issue Nov 16, 2019 · 1 comment

Comments

@myitcv
Copy link
Member

@myitcv myitcv commented Nov 16, 2019

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

$ go version
go version devel +c20b71eb37 Sat Nov 16 02:06:39 2019 +0000 linux/amd64
$ go list -m golang.org/x/tools
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2
$ go list -m golang.org/x/tools/gopls
golang.org/x/tools/gopls v0.1.8-0.20191115202509-3a792d9c32b2

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

What did you do?

We have a govim test that starts with a module containing the following file (on disk):

package main

import "fmt"

func main() {
	fmt.Println()
}

Then it creates a new buffer for const.go (i.e. does not exist on disk initially) and populates it with the following content:

  
package main

Then it saves const.go, triggering codeAction (for goimports-like fixing) followed by Formatting.

What did you expect to see?

  • diagnostics to be sent for const.go
  • the CodeAction call to not return a nil error and no edits
  • the Formatting call to return a nil error an edits to remove the first blank line

What did you see instead?

  • no diagnostics sent for const.go
  • the CodeAction call returns an error:
gopls.CodeAction() return; err: no ParseGoHandle for file:///tmp/go-test-script668847014/script-format_on_save_new_file_existing_package/const.go

gopls is also logging to stderr:

no results: no analyses for mod.com

Also of note is that the initial Configuration call to the client (govim) happens after govim has made a number of calls to gopls. This has certainly changed from before where config was always called first, with effectively any other activity being blocked on it returning (or at least that's how it appeared to work).

See gopls log: fail.log

Separately, this issue appears to be related to #35114 because sometimes we see the following on stderr:

file not found (open /home/myitcv/gostuff/src/github.com/myitcv/playground/const.go: no such file or directory)

cc @stamblerre @matloob

@gopherbot gopherbot added this to the Unreleased milestone Nov 16, 2019
@gopherbot gopherbot added the Tools label Nov 16, 2019
@myitcv

This comment has been minimized.

Copy link
Member Author

@myitcv myitcv commented Nov 18, 2019

This appears to have started as a result of https://go-review.googlesource.com/c/tools/+/206888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.