Install golang

  1. Download the latest version at studygolang.com/dl and unzip it
  2. Setting environment Variables
 export GOROOT=$your_path/go
 export GOBIN=$GOROOT/bin
 export PATH=$PATH:$GOROOT/bin:$GOPATH
Copy the code

3. Check whether go Version is installed successfully

  1. GOPROXY:
 go env -w GOPROXY=https://goproxy.cn,direct
Copy the code

Installing development tools

Goland or install the official plugin for IDEA Golang

Create a project

Create the following directories and files directly using development tools or manually

Go Mod dependency management

Mod provides the module, require, replace, and exclude commands

The module statement specifies the name (path) of the package. The dependency module specified by the require statement replaces the dependency module. The exclude statement ignores the dependency moduleCopy the code
  1. Add the dependent