Git Shell - go command not found

20,182

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.

Share:
20,182
Admin
Author by

Admin

Updated on July 09, 2022

Comments

  • Admin
    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 called Go or Golang and I downloaded this command program called Git 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
    Poutrathor over 5 years
    Can 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
    STREET MONEY about 4 years
    I had to add it this way export PATH=$PATH:/usr/local/go/bin
  • Junior Mayhé
    Junior Mayhé almost 3 years
    in gitbash for Windows, the /c/Users/<username>/.bashrc file can point to program files with GOPATH='/c/Program Files/Go/bin'