Ask questionsx/tools/cmd/gopls: "build cache is required, but could not be located: GOCACHE is not defined and $HOME is not defined"
Open go file in VSCode configured for using gopls language server.
No errors and working gopls.
Error on my package statement:
[Error - 11:39:40 PM] unable to check package for file:///<removed>.go: go [list -f {{context.GOARCH}} {{context.Compiler}} -- unsafe]: exit status 1: build cache is required, but could not be located: GOCACHE is not defined and $HOME is not defined
Installed gopls through:
go get -u golang.org/x/tools/cmd/gopls
This used to work a few days ago so I tested different commits and it seems that: 2c78df6d2ceec2cde4b7bff46c9b42cd05742fe1 is the most recent one that works (no errors). And next one: https://github.com/golang/tools/commit/7927dbab1be7d178ed14189b31e26c604b8baba8 causes it to break.
go version go1.12.5 darwin/amd64
Answer
questions
23doors
@zchee this fixed it, thank you! But on 2c78df6d2ceec2cde4b7bff46c9b42cd05742fe1 I wasn't required to set it, so this seems like a regression or a vscode-go issue. Also, I used same GOPATH and GOCACHE as from go env output.
Related questions