Description
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 anil
error and no edits - the
Formatting
call to return anil
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)