Ubuntu下安装go语言

参考:http://golang.org/doc/install/source

1. 下载go源代码

  1. sudo apt-get install mercurial
  2. hg clone -u release https://code.google.com/p/go

2. 编译安装go

  1. cd ~/go/src
  2. ./all.bash

安装完后会提示如下信息:

  1. ALL TESTS PASSED

  2. ---
  3. Installed Go for linux/amd64 in /home/you/go.
  4. Installed commands in /home/you/go/bin.
  5. *** You need to add /home/you/go/bin to your $PATH. ***


3. 测试go
vi hello.go:

  1. package main

  2. import "fmt"

  3. func main() {
  4. fmt.Printf("hello, world\n")
  5. }

运行:

  1. go run hello.go



更新go

  1. cd ~/go/src
  2. hg pull
  3. hg update release
  4. ./all.bash

 

posted on   Stomach_ache  阅读(248)  评论(0编辑  收藏  举报

编辑推荐:
· 继承的思维:从思维模式到架构设计的深度解析
· 如何在 .NET 中 使用 ANTLR4
· 后端思维之高并发处理方案
· 理解Rust引用及其生命周期标识(下)
· 从二进制到误差:逐行拆解C语言浮点运算中的4008175468544之谜
阅读排行:
· Cursor预测程序员行业倒计时:CTO应做好50%裁员计划
· 想让你多爱自己一些的开源计时器
· 大模型 Token 究竟是啥:图解大模型Token
· 用99元买的服务器搭一套CI/CD系统
· 当职场成战场:降职、阴谋与一场硬碰硬的抗争
< 2025年4月 >
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 1 2 3
4 5 6 7 8 9 10

导航

统计

点击右上角即可分享
微信分享提示