Introduction to go language - (I) environment construction

Zhou Zhaodong 2021-09-15 08:53:39
Let's explore GO The charm of language

brief introduction

Go Is an open source programming language , It makes construction simple 、 Reliable and efficient software becomes easy .
Go It's from 2007 Year end by Robert Griesemer, Rob Pike, Ken Thompson Host development , Later I joined in Ian Lance Taylor, Russ Cox wait forsomeone , And finally 2009 year 11 In open source , stay 2012 Released earlier this year Go 1 Stable version . Now? Go The development of is completely open , And have an active community .


  • concise 、 Fast 、 Security
  • parallel 、 Interesting 、 Open source
  • memory management 、 Array security 、 Compile quickly

    Environment building

    1. Download installation package

    1.1 You can visit GO Chinese language network Download installation package :


    1.2 If you can't download it, you can directly use the installation package I have downloaded ( Maybe the download is a little slow ):

    1.3 Use the next installation method to install , Note here that the address should be in the root directory , I just installed D Packing list :


    2. Configure environment variables

    Here I have configured the environment variables into the user variables

    2.1 To configure GOPATH and GOROOT


    2.2 To configure Path


    3. Verify installation results

    3.1 View version number
    go version


    3.2 Check the configuration
    go env


    4. Change the domestic image

    The initial settings are as follows :

    4.1 First of all, open go module
    go env -w GO111MODULE=on // Windows
    export GO111MODULE=on // macOS or Linux
    4.2 To configure GOPROXY

    Alibaba cloud :

    go env -w GOPROXY= // Windows
    export GOPROXY= // macOS or Linux

    Qiniuyun :

    go env -w GOPROXY= // Windows
    export GOPROXY= // macOS or Linux
    4.3 Cancel validation package

    Go 1.13 Default is set, Is used to verify the validity of the package . This website may not be accessible due to the wall , So you can use the following command to close :

    go env -w GOSUMDB=off // Windows
    export GOSUMDB=off // macOS or Linux


5. Start programming happily

5.1 install VS code

visit Official website , Download the installation package of the corresponding platform :

5.2 Next installation method

Stop talking, huh

5.3 Installing a plug-in

Just install two plug-ins here , A Chinese , One GO, There is also a to run the code

5.4 Get ready

Here you need to create three new folders , Namely src,bin and pkg
use VS code open src This folder and create a new file , Everyone here is free :

5.5 Start writing hello world Well

Create a new one first.go file

package main
import "fmt"
func main() {
fmt.Printf("hello world !!!")

Run directly :

Please bring the original link to reprint ,thank
Similar articles