Skip to content

gin: command not found #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andream16 opened this issue May 4, 2017 · 11 comments · May be fixed by #176
Open

gin: command not found #114

andream16 opened this issue May 4, 2017 · 11 comments · May be fixed by #176

Comments

@andream16
Copy link

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?

@JBaczuk
Copy link

JBaczuk commented May 26, 2017

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.

@kylerdanielster
Copy link

kylerdanielster commented Jun 19, 2017

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

@andream16
Copy link
Author

Same as for @kylerdanielster.

@WangShayne
Copy link

cp $GOPATH/bin/gin $GOROOT/bin

@ayush-usf
Copy link

The above worked !! Thank you so much @WangShayne

@lietu
Copy link

lietu commented Jun 30, 2020

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:

  1. Set up GOPATH in your environment. On *nix it could be e.g. $HOME/go, on Windows e.g. C:\source\go.
  2. Update your PATH to include $GOPATH/bin or %GOPATH%\bin. If your GOPATH is /home/user/go, include /home/user/go/bin to your PATH. If your GOPATH is /Users/user/go, include /Users/user/go to your PATH. If your GOPATH is C:\source\go include C:\source\go\bin in your PATH, and so on.
  3. Restart the applications in question - IDE, Terminals, etc. to ensure the PATH and GOPATH are properly updated, as the environment gets configured at the time the application starts, not at the time you try to run a command.
  4. Confirm the new environment is correct via go env and checking your PATH, e.g.

Linux, MacOS, etc.

echo $GOPATH
echo $PATH | grep $GOPATH

Windows

echo %GOPATH%
echo %PATH% | find "%GOPATH%"

@kdjomeda
Copy link

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]

@lietu
Copy link

lietu commented Sep 18, 2022

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

@kdjomeda
Copy link

Thanks @lietu that is helpful

awan1 added a commit to awan1/gin that referenced this issue Sep 23, 2022
@awan1 awan1 linked a pull request Sep 23, 2022 that will close this issue
@AntonGrekov
Copy link

AntonGrekov commented Jan 5, 2023

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

@MariuzM
Copy link

MariuzM commented Jun 3, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants