WillKre
WillKre

Reputation: 6168

Golang: Getting started - "go" is not recognized as an internal or external command"

Trying to get started with Go but I cant manage to set up the work environnement properly.

Upvotes: 14

Views: 50070

Answers (8)

Shivam Verma
Shivam Verma

Reputation: 21

There could be possibility that you have not installed the correct exe folder. for windows download the windows-Version.msi, In my case i previously installed amd processor exe file. hence it was not running.

Upvotes: 1

Muhammadalive
Muhammadalive

Reputation: 1086

You need to set path var like from C:\Users\YourUser\go to C:\Users\YourUser\ then you can see your go version in your command line go version

Upvotes: 0

Manisha Bhandari
Manisha Bhandari

Reputation: 11

If you are not able to solve the problem even after adding environment variables, you can check if you have installed Go extension from VSCode, install it if you haven't already. Then, when you create a new GO file to work in the working directory, "gopls command not available" will be popped up,click install all to get full support inside VSCode. I solved the issue like this, I hope that helps.

Upvotes: 1

remote007
remote007

Reputation: 57

I read various answers as well articles and most effective steps that helped me were :

  1. My Computer -> RC -> Properties
  2. Advanced System Settings -> Environment Variables
  3. Under System Variables Section -> New -> GOPATH -> Project Location
  4. Select Path -> New ->path to bin of installed go
  5. Save and close.
  6. Restart the cmd / system .
  7. Run go in the cmd to check the working .

Upvotes: 1

user3366943
user3366943

Reputation: 263

here's what made it work for me, assuming you hadnt change anything from a fresh GO install in windows 10.

  1. set GOROOT in user variables: C:\Go\

  2. add path in user variables: %USERPROFILE%\Go\bin

  3. add path in system variables: C:\Go\bin

Upvotes: 3

Nth.gol
Nth.gol

Reputation: 844

Aside from @Xeph's answer, just make sure if you recently installed Go that you use a fresh terminal/cmd window.

Upvotes: 12

Garima
Garima

Reputation: 41

Run command "go env" and check the path for variable "gopath" that's where you should keep your project. Else where if you run go command you will get error "go is not recognized as internal or external command"

Upvotes: 4

Xeph
Xeph

Reputation: 484

EDITED for future reference.

  1. You set your 'GOROOT' wrong. Set it to C:\Go\

  2. Include C:\Go\bin to your 'Path'

Upvotes: 12

Related Questions