go version)?$ go version go version go1.14.6 darwin/amd64
yes
go env)?go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/andig/Library/Caches/go-build"
GOENV="/Users/andig/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/andig/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.14.6/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14.6/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/andig/htdocs/mbmd/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/73/89ycv7qn51j4kbm04jsz9b840000gn/T/go-build854369359=/tmp/go-build -gno-record-gcc-switches -fno-common"
Upgrade gopls when prompted by vscode
Smooth coding as before
Lots of undeclared name: xyz errors in vscode and generally high CPU usage when using the go plugin. The code itself is fine and compiles on the command line.
Raising here as this happened immediately after upgrading gopls from 0.4.3 to 0.4.4. Tools have been reinstalled.
I'm also having issues with gopls after upgrading to 0.4.4 today.
Autocompletion and definitions are gone for me (except for basic text completion), and no syntax highlighting/errors show up at all no matter what I type. In my case, gopls does not have high CPU usage.
@andig: Please follow the troubleshooting instructions at https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md to capture logs, upload them here, and we'll take a look.
@rsikdar please do the same, but file a new issue rather than adding to this one. Similar symptoms can have different causes and it's better to keep them separate for now.
gopls 0.4.4 consumes tons of memory!
@apang1992 Please follow the instructions above and file a new issue and we'll take a look.
Here's the gopls server log- not much so see https://pastebin.com/tEQwYS3p. Is this what is required?
gopls 0.4.4 consumes tons of memory!
@404cn as written above, please open a separate issue
@heschik while waiting, is there any way to force a downgrade of gopls and tools to get back to a working state?
I'm having similar issues.
I noticed in the 0.4.4 release notes:
But I am specifically opening a few packages (vs-code with add-folder-to-workspace) instead of my entire module because my entire module is rather large with a large number of packages. Is there an option to get the old behavior?
@andig instructions to install a specific version are on https://github.com/golang/tools/blob/master/gopls/doc/user.md#installation.
You have an interesting workspace setup and I wonder if it's deliberate. From what I can tell there are two folders, /Users/andig/htdocs/mbmd and /Users/andig/htdocs/forecast. There is a go.mod in mbmd as I would expect, but forecast doesn't have one, and that folder is using a go.mod from htdocs instead. Is there a lot of stuff in htdocs?
You have an interesting workspace setup and I wonder if it's deliberate.
That's coincidence. All my projects reside in htdocs. My workspace typicially contains a bunch of project root folders, each one with its own go mod. I've removed the stray folder and excess go.mod.
I've downgraded to 0.15.2 and 0.4.3 and upgraded again. Now I've started getting this message:
You are neither in a module nor in your GOPATH. If you are using modules, please open your editor to a directory in your module. If you believe this warning is incorrect, please file an issue: https://github.com/golang/go/issues/new.
Didn't have any problems before gopls 0.4.4
Have you added each module to your workspace through View -> Add Folder to Workspace? Currently, gopls does not support opening a directory above a module.
@rsikdar, @apang1992, @404cn, @jrwren: Please file new issues so that we can discuss them separately. While the error messages may be the same, the cause of the issues are likely to be different.
Have you added each module to your workspace through View.
Yes.
I have meanwhile downgraded and upgraded again, both vscode extension and gopls. At this time, I'm not seeing errors anymore. One observation I've had is that vscode showed various errors and type hints that indicated it was working from an entirely outdated codebase (eg. old types that don't exist anymore shown in the hints, new types declared unknown).
Is there any type of cache in gopls that could be cleared?
You can try the "Go: Restart Language Server" command in VS Code to restart the language server. Do you mind providing an updated log after you deleted the stray go.mod file?
Do you mind providing an updated log after you deleted the stray go.mod file?
Not at all, thank you for the intensive care. Here's an updated log: https://pastebin.com/U7yR8C2W. I'm still (or again) seeing problems for things that compile fine:
handler.Timeout undefined (type *ASCIIClientHandler has no field or method Timeout)
Update not sure this one should compile, it doesn't on the command line either although that package most definitely exists, so not sure if there still is a gopls issue:
โฏ make build
go build
serial.go:12:2: cannot find package "github.com/grid-x/serial" in any of:
/usr/local/Cellar/go/1.14.6/libexec/src/github.com/grid-x/serial (from $GOROOT)
/Users/andig/go/src/github.com/grid-x/serial (from $GOPATH)
make: *** [build] Error 1
The error message looks like you're in GOPATH mode, but I believe you're using modules. Make sure that GO111MODULE does not equal off and that you are within a module when compiling.
Timed out in state WaitingForInfo. Closing.
(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)
Most helpful comment
gopls 0.4.4 consumes tons of memory!