go_01_Linux 下安装 go 语言环境

2021-04-30 01:28

阅读:413

标签:oca   windows   get   amd   block   Golan   msi   href   vim   

TSSC_go_install_linux

  • 下载地址

https://golang.org/dl/
https://golang.org/dl/go1.16.3.linux-amd64.tar.gz
https://golang.org/dl/go1.16.3.windows-amd64.msi
https://golang.org/dl/go1.16.3.darwin-amd64.pkg
https://golang.org/dl/go1.16.3.src.tar.gz

1.下载安装 go 软件

mkdir -p /opt/tools
cd /opt/tools
# wget https://golang.org/dl/go1.16.3.linux-amd64.tar.gz
wget https://studygolang.com/dl/golang/go1.16.3.linux-amd64.tar.gz
mkdir -p /usr/local/go
tar -xvf go1.16.3.linux-amd64.tar.gz -C /usr/local/go

2.设置环境变量

vim /etc/profile
---------------------------------
export GOROOT=/usr/local/go
export GOPATH=/usr/local/go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
---------------------------------

3.测试环境是否安装成功

mkdir -p /opt/tools/helloworld
cd /opt/tools/helloworld
vim helloworld.go
------------------------
package main
import "fmt"
func main() {
    fmt.Println("HelloWorld!")
}
------------------------

# 测试配置
go run ./helloworld.go
  • 完毕,呵呵呵

go_01_Linux 下安装 go 语言环境

标签:oca   windows   get   amd   block   Golan   msi   href   vim   

原文地址:https://www.cnblogs.com/tssc/p/14715461.html


评论


亲,登录后才可以留言!