gin
gin copied to clipboard
gin: command not found
Hi everybody,
after doing go get github.com/codegangsta/gin and doing gin -h I get gin: command not found. I'm doing gin -h inside my GOPATH. I'm running on 4.4.63-1-MANJARO.
What's causing this?
Have a look at this post: cannot-set-gopath-on-mac-osx
All I needed to do was to make sure my GOPATH environment variable was set, then restart the terminal.
I am having the same issue on mint 18.1 with go version go1.8.3 linux/amd64. The - gin -h 'gin: command not found'. When I run go env I see that my GOPATH is set to my workspace (GOPATH="/home/{user}/go"). This folder contains /src /bin /pkg folder's and I can see that gin is in the bin folder. When I run echo $PATH i see that GOPATH/bin (/go/bin) is in my PATH
gin will run if I use ~/go/bin/gin
Same as for @kylerdanielster.
cp $GOPATH/bin/gin $GOROOT/bin
The above worked !! Thank you so much @WangShayne
Don't copy files anywhere, you'll pollute your system with random files in random locations, instead ensure your system is properly configured.
When you install Golang, you should perform two steps that unfortunately the installation does not take care of:
- Set up
GOPATHin your environment. On *nix it could be e.g.$HOME/go, on Windows e.g.C:\source\go. - Update your
PATHto include$GOPATH/binor%GOPATH%\bin. If yourGOPATHis/home/user/go, include/home/user/go/binto yourPATH. If yourGOPATHis/Users/user/go, include/Users/user/goto yourPATH. If yourGOPATHisC:\source\goincludeC:\source\go\binin yourPATH, and so on. - Restart the applications in question - IDE, Terminals, etc. to ensure the
PATHandGOPATHare properly updated, as the environment gets configured at the time the application starts, not at the time you try to run a command. - Confirm the new environment is correct via
go envand checking yourPATH, e.g.
Linux, MacOS, etc.
echo $GOPATH
echo $PATH | grep $GOPATH
Windows
echo %GOPATH%
echo %PATH% | find "%GOPATH%"
Hello Guys,
Fasttrack to 2022, I find myself is the same situation. I am using Macos monterey with go 1.19.1. I just used the gin install command as documented in a module supported project using go get and it's not any where I can run it from. Following couple of the suggestions here below is what I have:
❯ echo $GOPATH
/Users/username/go
❯ echo $PATH | grep $GOPATH
/opt/homebrew/Cellar/go/1.19.1/libexec/bin:/Users/username/go/bin:/Users/username/.sdkman/candidates/springboot/cu..........
❯ ls -lh /Users/username/go
total 0
drwxr-xr-x 7 username staff 224B Sep 10 14:57 bin
drwxr-xr-x 4 username staff 128B Jul 5 07:32 pkg
I do not have the gin installed in the bin folder of the $GOPATH, instead it's in the pkg/mod. Not sure what to do from there
❯ ls -lh /Users/username/go/pkg/mod/github.com/codegangsta/
total 0
dr-xr-xr-x 8 username staff 256B Sep 18 11:12 [email protected]
dr-xr-xr-x 8 username staff 256B Sep 18 11:12 [email protected]
go get hasn't been the way to install binaries from go packages for some time, you need go install .. e.g. go install github.com/codegangsta/gin@latest
Thanks @lietu that is helpful
Sadly this PR above wasn't merged. In README.md it still says to invoke go get .... instead of go install ...
That wasted some time to find out
For me even thought i hat gin installed but it was not in go/bin folder so from the user root dir in terminal i installed gin again and now gin works