目录
安装
wget https://dl.google.com/go/go1.19.5.linux-amd64.tar.gz
tar zxvf go1.19.5.linux-amd64.tar.gz -C /usr/local/
# vim /etc/profile ###添加
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
source /etc/profile
运行go程序
[email protected][/zc/golang]# cat hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello World!!!")
}
[email protected][/zc/golang]# go run hello.go
Hello World!!!
编译go程序
[email protected][/zc/golang]# go build hello.go
[email protected][/zc/golang]# ls
hello hello.go
[email protected][/zc/golang]# ./hello
Hello World!!!
标签:root,Linux,zc,golang,172.16,go,安装,hello
From: https://www.cnblogs.com/shenyuanhaojie/p/17102389.html