This section is a hands-on tutorial for installing the Golang development environment and IDE configuration, specifically for Golang newbies. Experienced users may skip this.

Go Development Environment Installation

Step 1 - Download Go Development Package

Visit the Go domestic mirror site download page https://golang.google.cn/dl/, and select your current system version from the versions at the top of the page to download the latest version of the Go development package:

Installation - 图1

Step 2 - Installation Guide

Visit the official installation introduction page https://golang.google.cn/doc/install, and follow the corresponding installation process according to your current system version.

For Windows (msi) and MacOS (pkg), it is recommended to install using the package. The author’s current installation process for the MacOS package (pkg) is shown below:

Installation - 图2

Installation - 图3

Installation - 图4

The upgrade process for Go development package is the same.

IDE Development Environment Installation

Currently, there are two popular Go IDEs: VSCode+Plugins (free) and JetBrains‘s Goland (paid). As JetBrains is also a sponsor of the GoFrame framework, we recommend using Goland as the development IDE. For download and registration, please refer to online tutorials (Baidu or Google).

JetBrains official website: https://www.jetbrains.com

Using Goland

Let’s create the first Go program, following the usual convention with hello world.

Step 1. Open IDE

Installation - 图5

Step 2. Create Project

Note the Go installation file path (SDK), which is thoroughly explained in the official installation documentation, so please read it carefully.

The Location can be any local path you choose.

Installation - 图6

Step 3. Create Program

Create a new go file named hello.go and input the following code:

  1. package main
  2. import "fmt"
  3. func main() {
  4. fmt.Println("hello world!")
  5. }

Installation - 图7

Step 4. Run Execution

Menu Run - Run - go build hello.go.

Installation - 图8

Installation - 图9

Installation - 图10

Congratulations, your first Go program is successful!

Using VSCode

Step 1. Download and Install

Step 2. Install Go Extension

Step 3. Hello World