Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Weird loading workspace errors (strange packages) #1409

Answered by stamblerre
jef asked this question in Help
Discussion options

Problem

I'm continually getting these errors:

Error loading workspace: err: exit status 1: stderr: cannot find package "-e" in any of: /usr/local/opt/go/libexec/src/-e (from $GOROOT) /Users/<username>/.go/src/-e (from $GOPATH) cannot find package "-f" in any of: /usr/local/opt/go/libexec/src/-f (from $GOROOT) /Users/<username>/.go/src/-f (from $GOPATH) cannot find package "{{context.ReleaseTags}}" in any of: /usr/local/opt/go/libexec/src/{{context.ReleaseTags}} (from $GOROOT) /Users/<username>/.go/src/{{context.ReleaseTags}} (from $GOPATH) : packages.Load error

It's strange that it's trying to find these packages. They seem totally incorrect and somehow getting picked up.

I also ran >Go: Install/Update Tools, but didn't seem to fix (even though quite outdated).

Question

How do I fix this? 😅

Environment

Checking configured tools....
GOBIN: /Users/<username>/.go/bin
toolsGopath: 
gopath: /Users/<username>/.go
GOROOT: /usr/local/opt/go/libexec
PATH: /usr/local/opt/go/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/<username>/.go/bin:<redacted>
 gopkgs: /Users/<username>/.go/bin/gopkgs installed
 go-outline: /Users/<username>/.go/bin/go-outline installed
 gotests: /Users/<username>/.go/bin/gotests installed
 gomodifytags: /Users/<username>/.go/bin/gomodifytags installed
 impl: /Users/<username>/.go/bin/impl installed
 goplay: /Users/<username>/.go/bin/goplay installed
 dlv: /Users/<username>/.go/bin/dlv installed
 dlv-dap: dlv-dap not installed
 staticcheck: /Users/<username>/.go/bin/staticcheck installed
 gopls: /Users/<username>/.go/bin/gopls installed
go env
Workspace Folder (tmp.dodDhsRh): /private/var/folders/4r/8r1g__pn3w360gzv51wfd3rhl1305x/T/tmp.dodDhsRh
	GO111MODULE=""
	GOARCH="amd64"
	GOBIN="/Users/<username>/.go/bin"
	GOCACHE="/Users/<username>/Library/Caches/go-build"
	GOENV="/Users/<username>/Library/Application Support/go/env"
	GOEXE=""
	GOFLAGS=""
	GOHOSTARCH="amd64"
	GOHOSTOS="darwin"
	GOINSECURE=""
	GOMODCACHE="/Users/<username>/.go/pkg/mod"
	GONOPROXY=""
	GONOSUMDB=""
	GOOS="darwin"
	GOPATH="/Users/<username>/.go"
	GOPRIVATE=""
	GOPROXY="https://proxy.golang.org,direct"
	GOROOT="/usr/local/opt/go/libexec"
	GOSUMDB="off"
	GOTMPDIR=""
	GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
	GOVCS=""
	GOVERSION="go1.16.3"
	GCCGO="gccgo"
	AR="ar"
	CC="clang"
	CXX="clang++"
	CGO_ENABLED="1"
	GOMOD="/var/folders/4r/8r1g__pn3w360gzv51wfd3rhl1305x/T/tmp.dodDhsRh/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4r/8r1g__pn3w360gzv51wfd3rhl1305x/T/go-build2594453877=/tmp/go-build -gno-record-gcc-switches -fno-common"
$ go version
go version go1.16.3 darwin/amd64
$ gopls -v version
Build info
----------
golang.org/x/tools/gopls v0.6.9
 golang.org/x/tools/gopls@v0.6.9 h1:LBBcE2y3Tb4bp79JVLWCQBbvYCFEs5ADGWsQDoSLk1Q=
 github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
 github.com/google/go-cmp@v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
 github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
 golang.org/x/mod@v0.4.1 h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY=
 golang.org/x/sync@v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
 golang.org/x/sys@v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
 golang.org/x/tools@v0.1.1-0.20210319172145-bda8f5cee399 h1:O5bm8buX/OaamnfcBrkjn0SPUIU30jFmaS8lP+ikkxs=
 golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
 honnef.co/go/tools@v0.1.1 h1:EVDuO03OCZwpV2t/tLLxPmPiomagMoBOgfPt0FM+4IY=
 mvdan.cc/gofumpt@v0.1.0 h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw=
 mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
$ code -v
1.55.0
c185983a683d14c396952dd432459097bc7f757f
x64
You must be logged in to vote

Can you please share your gopls logs? Information on how to capture them can be found here.

Replies: 1 comment 2 replies

Comment options

Can you please share your gopls logs? Information on how to capture them can be found here.

You must be logged in to vote
2 replies
Comment options

Also, do you possibly have a wrapper script around the go command? This looks like an issue with argument passing.

Comment options

Hey @stamblerre, I just found the issue. I suppose it had to do with some old settings I had in my settings.json?

Removing these lines:

{
 "go.buildFlags": [
 "-v",
 "cmd"
 ],
}

Seemed to do the trick. Kind of strange, but probably from some old extension. In turn, I ended up removing all go.* related settings and start from scratch. Seems to be working great.

Thanks for helping me troubleshoot!

Answer selected by jef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /