Go environment configuration and GoLand installation on Windows
Install and configure Golang
- Go to Go software to install and download the relevant version
. The corresponding version for Windows is:go1.4.windows-amd64.msi
,click to download. - double click
.msi
file to start the installation.- all the way
next
In the step of selecting the installation directory, the default is to install to the C drive, or it can be installed to other disks, then you need to manually modify the value of the system environment variable.Assuming installed to E:\Go
Under contents.
- all the way
- Configure environment variables
- Open system environment variables
Right click on My Computer -> Properties -> About -> Advanced System Settings -> Environment Variables -> System Variables
,new
Add toGOROOT
andGOPATH
s as shown in the figure. - Modify the PATH of the system environment variable, edit, add
%GOROOT%\bin
- Open system environment variables
test installation
- Create a new hello.go file
// hello_world.go
package main
func main ( ) {
println ( "Hello" , "Golang!" )
}
- 1
- 2
- 3
- 4
- 5
- 6
-
in the directory where the file is located
shift+right click
, clickOpen a Powershell window here
. Enter in the pop-up windowgo run hello.go
, the output as shown in the figure indicates success.
This is one of the ways we program in Go. -
Of course you can also
cmd command line
input ingo version
Check the current version, if a successful display is displayed, the installation is successful.
Build an integrated development environment GoLand
Click here to download and install GoLand. The installation process is very simple, select the directory you want to install all the way to next.
Note that the Add environment variable is checked at this step.
After the installation is complete, open and create a new project
- Create a new helloGolang.go file and run it as follows:
- GoLand Common Shortcuts
Ctrl+D Copy the line content down
Ctrl+Y Delete the current line
Ctrl+Alt+Enter Cursor jump up, create a new blank line
Ctrl+Enter Cursor jump down, create a new blank line
Alt+up and down arrows The cursor jumps between adjacent functions