VSCode won't install gopls when following tast quickstart instructions?

1,234 views
Skip to first unread message

James Cook

unread,
Sep 30, 2021, 2:09:55 PM9/30/21
to tast-users
I'm not very familiar with go or go tooling, so I'm following the IDE setup instructions at https://chromium.googlesource.com/chromiumos/platform/tast/+/HEAD/docs/quickstart.md#ide

The Go plugin installs, but then fails to install dlv-dap, staticcheck and gopls. 

gopls: failed to install gopls(golang.org/x/tools/gopls): Error: Command failed: /usr/lib/google-golang/bin/go get -v golang.org/x/tools/gopls
go get: installing executables with 'go get' in module mode is deprecated.
To adjust and download dependencies of the current module, use 'go get -d'.
To install using requirements of the current module, use 'go install'.
To install ignoring the current module, use 'go install' with a version,
like 'go install example.com/cmd@latest'.
or run 'go help get' or 'go help install'.

(Full logs: paste/4949516223512576)

Attempting to run "go install" also fails:

jamescook@jamescook:/x/chromeos/src/platform/tast-tests/local_tests ((f4b8e9c22...))$ go install golang.org/x/tools/gopls@latest
# os/user
cgo: C compiler "clang" not found: exec: "clang": executable file not found in $PATH

I use clang to compile chromium code, but it's the copy managed by depot_tools. That doesn't seem like something I should be pointing go binaries at.

I'm on gLinux with a manually installed copy of VSCode 1.60.2. I'm not sure what version of go this is:

jamescook@jamescook:/x/chromeos/src/platform$ go version
go version devel +b7a85e0003 linux/amd64

I think my GOPATH is good:
jamescook@jamescook:/x/chromeos/src/platform/tast-tests/local_tests ((f4b8e9c22...))$ echo $GOPATH
/usr/local/google/home/jamescook/go:/x/chromeos/src/platform/tast-tests:/x/chromeos/src/platform/tast:/x/chromeos/chroot/usr/lib/gopath

I tried the settings.json suggestions from this thread (GO111MODULE) and this thread (GOPACKAGESDRIVER), but that didn't help.

What am I missing?

Thanks,
James

James Cook

unread,
Sep 30, 2021, 3:33:17 PM9/30/21
to tast-users, James Cook
Update: I was able to get things working with a combination of:

sudo apt install clang
GO111MODULE=on go get golang.org/x/tools/gopls

Now the VSCode plug is able to install analysis tools, and I have code completion.

Still, I wonder what went wrong, and whether we could update the docs somehow to help others avoid this.
Reply all
Reply to author
Forward
0 new messages