Getting started with Go

Posted May 25, 20202 min read


GO language

The Go language that has been heard for a long time, let's get started today.

One of the reasons why Go is popular is that it has CoreOS, Kubernetes(Google), InfluxDB well-known large customers, and Docker is also written in Go language.

Functional features of Go language(all these features, learn slowly and understand later)

  • Concurrency support
  • Simplicity and consistency
  • Object-oriented
  • Pointer
  • translater
  • Package management

Go language standard library address official website Chinese

Project source address

Get started quickly

Through the installation package

Domestic download address:


  ~ go version
go version go1.14.3 darwin/amd64
# If the command does not exist, add environment variables
# ~/.bash_profile
export PATH = $PATH:/usr/local/go/bin

Accelerator is necessary in China

# Enable Go Modules function
go env -w GO111MODULE = on
go env -w GOPROXY =
go env -w GOPROXY =
go env -w GOPROXY =

# Go version> = 1.13
go env -w GOPROXY =,direct
# Set the private warehouse without proxy, multiple separated by commas
go env -w GOPRIVATE = *.

# Detection
go env | grep GOPROXY
go env | grep GOBIN

Open Go's "Hello world"

Create file hello.go file

package main

import "fmt"

func main() {
    fmt.Printf("hello, world \ n")


$go run hello.go
hello, world


 go build -o hello hello.go
 # executable file
 Hello, world.

Mac | exe files can also be compiled on Linux

GOOS = windows go build -o hello.exe hello.go

Windows compilation

go build -o hello.exe hello.go

See the address below for more


The choice of tools seems to be more vscode, the other is GoLand, attach the address

Use vscode, add go plugin


Collect some learning materials

Go official website blog

Go Chinese Community

Knowledge Graph

Chinese Online