Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Configure the GO environment and install IDE

Shulou Source: shulou.com Published: 2022-06-03 05:50:55 11月23日 Update

I. Environmental preparation

Operating System: Ubuntu 16.04

GO Version: 1.9.2

Get Go installation package

$ wget https://www.golangtc.com/static/go/1.9.2/go1.9.2.linux-amd64.tar.gz

Extract the installation package

#Create language directory to store go program--GOROOTmkdir /opt/language/#Create go and three directories under go to store go package, binary, source code--GOPATHmkdir -p /go/{src,bin,pkg}$ tar -xvf go1.9.2.linux-amd64.tar.gz -C /opt/language/

Configure environment variables

$ sudo vim /etc/profile.d/go.sh export GOROOT=/opt/language/go export GOBIN=/opt/go/bin export GOPATH=/opt/go export PATH=$PATH:$GOROOT/bin#Load environment variable file $ source /etc/profile.d/go.sh

View GO Configuration

$ go env

II. Configure GO IDE

Download and install atom

#Download atom$ wget https://github.com/atom/releases/download/v1.23.3/atom-amd64.tar.gz Extract atom to/opt under $ tar -xvf atom-amd64.tar.gz -C /opt Go to atom directory $ cd /opt/atom/#Start atom$ ./ atom

Configuration atom

Install go-plus

III. Code preparation

Hello world Hello world

$ vim hello.go//Specify program entry, main package main//import fmt package import "fmt"//execute main function func main() { fmt.Println("Hello world! ")}

Tags: Configuration environment directory variable version program operating system three binary code entry function file source code system classic preparation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MariaDB Apple Linux Docker