go语言的通过安装包搭建环境

rlk@rlk:go$ go get golang.org/x/sys/unix
    go get github.com/tobert/pcstat/pcstat
Command 'go' not found, but can be installed with:

sudo snap install go         # version 1.18.5, or
sudo apt  install golang-go  # version 2:1.13~1ubuntu2
sudo apt  install gccgo-go   # version 2:1.13~1ubuntu2

See 'snap info go' for additional versions.

rlk@rlk:go$     go get github.com/tobert/pcstat/pcstat

Command 'go' not found, but can be installed with:

sudo snap install go         # version 1.18.5, or
sudo apt  install golang-go  # version 2:1.13~1ubuntu2
sudo apt  install gccgo-go   # version 2:1.13~1ubuntu2

See 'snap info go' for additional versions.

通过第一种方法安装失败

rlk@rlk:go$ sudo snap install go
[sudo] password for rlk: 
error: This revision of snap "go" was published using classic confinement and thus may perform
       arbitrary system changes outside of the security sandbox that snaps are usually confined to,
       which may put your system at risk.

       If you understand and want to proceed repeat the command including --classic.

通过第二种方法安装成功

rlk@rlk:go$ sudo apt  install golang-go
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  golang-1.10-go golang-1.10-race-detector-runtime golang-1.10-src golang-race-detector-runtime golang-src
Suggested packages:
  bzr mercurial subversion
The following NEW packages will be installed:
  golang-1.10-go golang-1.10-race-detector-runtime golang-1.10-src golang-go golang-race-detector-runtime
  golang-src
0 upgraded, 6 newly installed, 0 to remove and 6 not upgraded.
Need to get 40.3 MB of archives.
After this operation, 225 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.cn99.com/ubuntu bionic-updates/main amd64 golang-1.10-src amd64 1.10.4-2ubuntu1~18.04.2 [11.1 MB]
Get:2 http://mirrors.cn99.com/ubuntu bionic-updates/main amd64 golang-1.10-go amd64 1.10.4-2ubuntu1~18.04.2 [28.6 MB]
Get:3 http://mirrors.cn99.com/ubuntu bionic/main amd64 golang-1.10-race-detector-runtime amd64 0.0+svn285455-0ubuntu1 [478 kB]
Get:4 http://mirrors.cn99.com/ubuntu bionic/main amd64 golang-src amd64 2:1.10~4ubuntu1 [3,676 B]                
Get:5 http://mirrors.cn99.com/ubuntu bionic/main amd64 golang-go amd64 2:1.10~4ubuntu1 [22.0 kB]                 
Get:6 http://mirrors.cn99.com/ubuntu bionic/main amd64 golang-race-detector-runtime amd64 2:1.10~4ubuntu1 [3,456 B]
Fetched 40.3 MB in 27s (1,505 kB/s)                                                                              
Selecting previously unselected package golang-1.10-src.
(Reading database ... 230565 files and directories currently installed.)
Preparing to unpack .../0-golang-1.10-src_1.10.4-2ubuntu1~18.04.2_amd64.deb ...
Unpacking golang-1.10-src (1.10.4-2ubuntu1~18.04.2) ...
Selecting previously unselected package golang-1.10-go.
Preparing to unpack .../1-golang-1.10-go_1.10.4-2ubuntu1~18.04.2_amd64.deb ...
Unpacking golang-1.10-go (1.10.4-2ubuntu1~18.04.2) ...
Selecting previously unselected package golang-1.10-race-detector-runtime.
Preparing to unpack .../2-golang-1.10-race-detector-runtime_0.0+svn285455-0ubuntu1_amd64.deb ...
Unpacking golang-1.10-race-detector-runtime (0.0+svn285455-0ubuntu1) ...
Selecting previously unselected package golang-src.
Preparing to unpack .../3-golang-src_2%3a1.10~4ubuntu1_amd64.deb ...
Unpacking golang-src (2:1.10~4ubuntu1) ...
Selecting previously unselected package golang-go.
Preparing to unpack .../4-golang-go_2%3a1.10~4ubuntu1_amd64.deb ...
Unpacking golang-go (2:1.10~4ubuntu1) ...
Selecting previously unselected package golang-race-detector-runtime.
Preparing to unpack .../5-golang-race-detector-runtime_2%3a1.10~4ubuntu1_amd64.deb ...
Unpacking golang-race-detector-runtime (2:1.10~4ubuntu1) ...
Setting up golang-1.10-src (1.10.4-2ubuntu1~18.04.2) ...
Setting up golang-1.10-go (1.10.4-2ubuntu1~18.04.2) ...
Setting up golang-1.10-race-detector-runtime (0.0+svn285455-0ubuntu1) ...
Setting up golang-src (2:1.10~4ubuntu1) ...
Setting up golang-race-detector-runtime (2:1.10~4ubuntu1) ...
Setting up golang-go (2:1.10~4ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...

测试

rlk@rlk:go$ go version
go version go1.10.4 linux/amd64
rlk@rlk:go$ 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值