Git Shell - go command not found
Solution 1
You have to put the Go executable in your PATH:
1) cd ~
2) vi .bashrc
3) Inside .bashrc, enter the following: PATH=$PATH:/c/Go/bin
Restart git bash and you should now have the go
command
Solution 2
You need to set GOPATH environment variable with the path of your GO installation directory.
For example if your Go installation directory is C:\Go
Open a bash terminal and run the following:
GOPATH=/c/Go/bin
Then type go version
to check if it works
you should see the go version you installed
Solution 3
The Go compiler is not part of Git Bash; you need to install it separately.
See the download page on http://golang.org/; for Windows, one of the MSI installers is most likely to be appropriate.
Admin
Updated on July 09, 2022Comments
-
Admin almost 2 years
I found this course on a website called Lynda.com (some of you probably know about this website).
The course was called:
Code Clinic: Go
. So, I'm using something calledGo
orGolang
and I downloaded this command program calledGit Shell
, and whenever I execute a Go Command, I get this message:bash: go : command not found
Does anybody know what's going on?
-
Poutrathor over 5 yearsCan you explain me why it says to set it to the workspace rather that GO installation directory here : golang.org/doc/code.html#GOPATH
-
STREET MONEY about 4 yearsI had to add it this way
export PATH=$PATH:/usr/local/go/bin
-
Junior Mayhé almost 3 yearsin gitbash for Windows, the /c/Users/<username>/.bashrc file can point to program files with
GOPATH='/c/Program Files/Go/bin'