Reputation: 483
I'm using RHEL 8.6 and my Go version is the following:
$ go version
go version go1.18.3 linux/amd64
I'm trying to install locally golangci-lint
and none of the described ways in the documentation are working.
What I tried:
First:
$ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.46.2
golangci/golangci-lint info checking GitHub for tag 'v1.46.2'
golangci/golangci-lint info found version: 1.46.2 for v1.46.2/linux/amd64
golangci/golangci-lint info installed /home/acabista/go/bin/golangci-lint
$ golangci-lint --version
bash: golangci-lint: command not found...
Second:
$ go install github.com/golangci/golangci-lint/cmd/[email protected]
$ golangci-lint --version
bash: golangci-lint: command not found...
Am I missing a step? How can I make this local installation work?
Upvotes: 5
Views: 18320
Reputation: 53
I had similar problem installing golangci-lint
. I resolved it by adding this PATH=$PATH:$(go env GOPATH)/bin/
to my ~/.bashrc
file and run source ~/.bashrc
on the terminal.
To verify, check the version by running the command from terminal golangci-lint --version
Reference: Found the solution from this github discussion here
Upvotes: 4
Reputation: 395
Install it this way to avoid error
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH)/bin v1.54.0
Upvotes: 0
Reputation: 1037
If golang-ci has properly been installed, the issue is most likely that the installation directory is not in your PATH
environment variable. Calling golang-ci this way should then work:
${GOPATH}/bin/golangci-lint --version
or
/home/acabista/go/bin/golangci-lint --version
To chek what is happening exactly you can check the content of the GOPATH
environment variable. Its content defines where binaries are installed when a go install
like command is run.
echo $GOPATH
You need to check also what is the content of the PATH
variable, this one defines in which directory the shell looks for binary to execute:
echo $PATH
Upvotes: 9