After installing the Go plugin in VS Code, when you open a Go project the editor prompts you to install the toolchain.
But golang.org is not directly accessible, so we need to download the packages manually into the GOPATH directory and install them there.
- Create the package directory
1
2
| cd $GOPATH
mkdir -p src/golang.org/x
|
- Download the packages
1
2
3
| cd src/golang.org/x
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/lint.git
|
- Install the packages
1
2
| go get golang.org/x/tools/...
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.27.0
|