Can't install golangci-lint locally - shell

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/golangci-lint#v1.46.2
$ golangci-lint --version
bash: golangci-lint: command not found...
Am I missing a step? How can I make this local installation work?

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

Related

not solve the error ::protoc-gen-go-grpc: program not found or is not executable

protoc-gen-go-grpc: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.
not solve the problem for :
ubuntu so please give me the answers
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
and
sudo apt install golang-goprotobuf-dev
and
sudo apt-get protobuf-compiler
You should be able to:
go install github.com/golang/protobuf/protoc-gen-go#latest
Then:
which protoc-gen-go
/${GOPATH}/bin/protoc-gen-go
If you haven't already, execute the following:
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc#latest
This will install protoc-gen-go-grpc executable to the location indicated by $GOBIN (default if not set is $GOPATH/bin)
$ ls $(go env GOPATH)/bin | grep 'protoc-gen-grpc-gateway'
protoc-gen-grpc-gateway
The protoc compiler is looking to run this executable, so you'll need to make sure it is resolvable via your $PATH environment variable.

Need help on setting up Beego and Bee dev tool

Go is already installed in my system.
and path variable is in .bashrc file.
# Golang
export PATH=$PATH:/usr/local/go/bin
$ go version
go version go1.16.14 linux/amd64
Now, I am willing to work with Beego and bee dev tools. For that, I installed Beego and Bee by using these commands.
$ go get -u github.com/beego/beego/v2
$ go get -u github.com/beego/bee/v2
both got successfully installed. but when I am using the command bee version it is resulting this in the Terminal.
Command 'bee' not found, did you mean:
command 'tee' from deb coreutils (8.30-3ubuntu2)
command 'see' from deb mime-support (3.64ubuntu1)
Try: sudo apt install <deb name>
I am a beginner in the programming world. I am not sure How to resolve it. Can Someone help me with this?
I had the same issue. When using the command bee is installed in home/go/bin. What I did was copy the bee file from there and paste it in usr/local/go/bin. Also I used go install instead of go get and at the end of the url I added the version I wanted, eg. #v2.0.2
You need to have GOPATH determination. If you don't, create a folder which named as go and it needs to have src,pkg,bin folders.
When you install successfully, you can see bee file in bin folder.
NOTE: You can see go environment with go env command.

"make: go: command not found" - although go binary is in $PATH

I want to build runC on a Raspbian GNU/Linux 10 (buster), Linux 4.19.97-v7+.
I downloaded the go1.15.6 ARMv6 version, extracted it to /usr/local and updated $PATH & $GOPATH.
go version returns
go version go1.15.6 linux/arm
and echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin
Following the instructions for building runC, running sudo make install returns
make: go: command not found
install -D -m0755 runc /usr/local/sbin/runc
Why doesn't it find the go binary?
As far as I'm aware, sudo runs the program as the root user, not your current user. As such, it may be the case where the $PATH obtained by the Makefile is not the same as it is on your current user.
To fix this, you could run sudo -E make install, where -E ensures that your environment is preserved.
make has its own PATH. Consult make‘s documentation.

Install snap on Ubuntu Precise

After a purchase of ARK-20-S8A11E, i find out that it only supports ubuntu 12.04 and that network manager uses snap which only availale on ubuntu 14 onward. I need Mobilemanager to collect information of an LTE module integrated in the PC.
For that, i tried to install snap from source.
I needed "go", and with apt-get install golang, the last version installed on precise is go1. and snap uses go1.6 onward version.
Therefore, i installed the latest version of go from sources. It is well installed, the output of go --version is : go version go1.11.4 linux/amd, and tested a basid hello.go.
I followed this link for snap installation: https://github.com/snapcore/snapd/blob/master/HACKING.mdsnap.
The build command " sudo -E go build -o /tmp/snap github.com/snapcore/snapd/cmd/snap" give an output as the "go command not found".
The GOPATH and PATH are well verified, the go env also.
Could you please help me sort this issue?
Thank you,
sudo is the troublemaker here. When sudoing the $PATH env var is replaced with the secure_path from /etc/sudoers (see this and this.)
Either do not run go as sudo, add the go path to the secure_path or include the full path to go in your command (sudo -E /usr/local/bin/go build -o /tmp/snap github.com/snapcore/snapd/cmd/snap)

How to install connect for use as an executable with bash

I've installed Connect via npm but can't access it's executable, how do I install it?
$ node -v
v0.4.7
$ npm -v
1.0.6
$ express -v
2.3.4
$ connect -v
-bash: connect: command not found
Update
I've added it to the $PATH:
$ npm link connect
../../node_modules/connect -> /Users/Alfred/local/lib/node_modules/connect
export PATH=$HOME/local/lib/node_modules/connect:$PATH' >> ~/.bash_profile
$PATH
-bash: /Users/Alfred/.rvm/gems/ruby-1.9.2-p0/bin:/Users/Alfred/.rvm/gems/ruby-1.9.2-
p0#global/bin:/Users/Alfred/.rvm/rubies/ruby-1.9.2p0/bin:/Users/Alfred/.rvm/bin:/Users
/Alfred/local/lib/node_modules/connect:/Users/Alfred/local/bin:/usr/bin:/bin:/usr/sbin:
/sbin:/usr/local/bin:/usr/local/lib:/usr/local/git/bin:/ usr/X11/bin: No such file or
directory
But it still don't work...
node as a bash executable runs you a node interpreter.
npm as a bash executable allows you to use npm to install programs.
express as a bash executable sets up boilerplate code for.
connect as a bash executable does nothing. This is normal.
All modules do nothing by default. npm, node and express are exceptions.
Note that npm has some kind of API to find the version of connect

Resources