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.msifile to start the installation.
    • all the waynextIn 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:\GoUnder contents.
  • Configure environment variables
    • Open system environment variablesRight click on My Computer -> Properties -> About -> Advanced System Settings -> Environment Variables -> System Variables,newAdd toGOROOTandGOPATHs as shown in the figure.
    • Modify the PATH of the system environment variable, edit, add%GOROOT%\bin
      insert image description here
      insert image description here

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 locatedshift+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.
    insert image description here
    This is one of the ways we program in Go.

  • Of course you can alsocmd command lineinput ingo versionCheck 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.
insert image description here
After the installation is complete, open and create a new project

  • Create a new helloGolang.go file and run it as follows:

insert image description here

  • 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

Related: Go environment configuration and GoLand installation on Windows