一天工夫转职Go工程师

Go官网网址
Go官网中国镜像网址
Go中文爱好者网址

驯服之路

1、Go开发环境搭建2、HelloWorld

Go开发环境搭建

官网参考

# download go-archive$ wget https://golang.google.cn/dl/go1.17.7.linux-amd64.tar.gz# Extract the archive you downloaded into /usr/local, creating a Go tree in /usr/local/go$ sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.17.7.linux-amd64.tar.gz# 配置GO相干环境变量$ export GOROOT=/usr/local/go    # 源码包所在门路$ export GOPATH=$HOME/go    # 开发者的Go我的项目所在门路$ export PATH=$PATH:$GOROOT/bin:$GOPATH/bin    # 把下面的门路增加到PATH环境变量# 验证是否装置胜利$ go versiongo version go1.17.7 linux/amd64

HelloWorld

$ mkdir -p $GOPATH/src/helloworld && cd $GOPATH/src/helloworld$ vim helloworld.go
// helloworldpackage mainimport (    "fmt")func main() {    fmt.Println("Hello World!")}
$ go run helloworld.goHello World!

...