- Go to https://golang.org/dl/ and download the installer for your OS.
- Run the installer and accept all default prompts.
- Create a folder called "Projects" in your home folder.
- In the start menu search for
env
then select "Edit environment variables for your account". - Add a new variable called
GOPATH
with a value of%USERPROFILE%\Projects
. - Edit the
PATH
variable and add this to whatever is already there;%GOPATH%\bin
. - In the start menu search for
cmd
then run it. - In the cmd window run
go env
. You should see theGOPATH
variable you set. - Close that cmd window
Git is required to use the go get
feature to install projects hosted on github or other Git based services.
- Do a Google search for "git for windows" and go to the first one. It should be https://git-scm.com/download/win
- Download and run the installer. I would check the boxes to add additional desktop icons. When prompted leave the default choice of "Use Git From the Windows Command Prompt".
Open a cmd window and run go get github.com/golang/lint/golint
.
After that is done run golint -h
and see if it works. It should give you the help message for a program called golint. If this does not work then you've likely misconfigure the PATH
or GOPATH
variables so go back and check those.
- Go to https://code.visualstudio.com/ and download the installer.
- Run the installer. I would check the boxes to add to context menus.
- Let Code launch after installation (or launch it yourself).
- Open the command palette with ctrl-shift-p
- Start typing "install extension" and choose that option
- Choose the
Go
extension. It will go away then after a minute say'Go' was successfully installed. Restart to enable it.
Choose to restart it. - Open the
HOME\Projects\src\github.com
folder. Under that create a folder namedyour-username
and under that create a folder namedgreet
. In that folder create a filemain.go
and open it. - In the bottom right a warning "Analysis Tools Missing" will show up. Click it then click "install" in the pop up window. Wait for it to stop printing anything.
- Open your editor preferences by going to File > Preferences > User Settings. Add this
"go.formatOnSave": true
- Restart VS Code
Hi team,
I tried installing go in my windows and tried setting Go111Module=On. after doing this getting error.
a command used go env -w GO111MODULE=ON
go: unknown environment setting GO111MODULE=ON
After trying to uninstall and reinstall go also getting the same error.
Thanks,
Binu