Hello,
I’ve set up Rocky on one of my machines recently to do some Go development.
Here are a few notes on setting up my Rocky installation. I hope you’ll find in useful and please feel free to ask questions and add your suggestions.
Rocky Linux
I’ve installed Rocky Linux 9.1 GNOME (Lite Workstation) — this can be found on the Alternative Images download page.
Go
Install Go with the following:
sudo dnf install golang-bin
Update PATH
for Go. I created the file ~/.bashrc.d/go.bash
with the following contents:
# Check if `go` command exists
if hash go &> /dev/null
then
gopath="$(go env GOPATH)/bin"
if ! [[ "$PATH" =~ "${gopath}:" ]]
then
PATH="${gopath}:$PATH"
fi
unset gopath
fi
export PATH
Restart your terminal to apply the changes.
Vim and vim-go
I’m a long-time vim
user, so I decided to use vim-go plugin. So, I installed all the packages with:
sudo dnf install vim-enhanced vim-go
Note: vim-go
requires EPEL repo to be enabled.
For its functionality vim-go
plugin depends on some tools. To install those tools you advised to start vim
and run :GoInstallBinaries
.
However, running that command leads to error messages during the installation of some tools. Let’s try to install those tools manually:
$ go install -v -mod=mod github.com/mgechev/revive@latest
$ go install -v -mod=mod golang.org/x/tools/gopls@latest
$ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
$ go install honnef.co/go/tools/cmd/staticcheck@2022.1.3