Download and install Golang:
First, we need to download and install Golang on the Linux system, the steps are as follows:
In the terminal, obtain the official Golang installation package through the following command:
wget https://golang.org/dl/
Unzip To install the package, you can use the following command:
tar -zxvf go1.*.linux-amd64.tar.gz
mv go /usr/local
export GOROOT=/usr/local/go export GOPATH=$HOME/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
Configure alternate libraries:
Golang is an open source programming language that has a large amount of community support, and many commonly used libraries and tools can be found in GitHub. In order to facilitate developers to develop quickly, we can download these libraries to the local computer. Steps:git clone git://github.com/ThinkiumGroup/go-common.git
cd go-common
go get ./...
In order to facilitate developers to get started quickly, we can create a simple hello world program.
Steps:
vim hello.go
package main import "fmt" func main() { fmt.Println("Hello, World!") }
go build hello.go ./hello
The output is :Hello, World!
The above is the detailed content of How to install and configure golang on linux. For more information, please follow other related articles on the PHP Chinese website!