ubuntu下搭建Go语言(golang)环境
2019/7/10 22:14:10
本文主要是介绍ubuntu下搭建Go语言(golang)环境,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Go语言是谷歌2009发布的第二款开源编程语言。Go语言专门针对 多处理器系统应用程序的编程进行了优化,使用Go编译的程序可以媲美C或C++代码的速度,而且更加安全、支持并行进程。
还是我自己的电脑,我自己安装的是ubuntu 12.04版本的,直接介绍安装吧!其实搭建环境很简单!
复制代码 代码如下:
sudo apt-get install python-setuptools python-dev build-essential //安装mercurial依赖
sudo easy_install mercurial //安装mercurial
获取go语言包
复制代码 代码如下:
hg clone -r release https://go.googlecode.com/hg/ go
编译安装golang
复制代码 代码如下:
cd go/src
./all.bash
ubuntu到这里其实就安装成功了,要配置PATH了,就是我们的windows里的环境变量
复制代码 代码如下:
Installed Go for linux/386 in /home/widuu/source/go
Installed commands in /home/widuu/source/go/bin
*** You need to add /home/widuu/source/go/bin to your PATH.
然后我们弄个文件试试
复制代码 代码如下:
sudo vim hello.go
package main
import "fmt"
func main() {
fmt.Printf("hello, 微度网络\n")
}
go build hello.go
./hello
输出hello,微度网络
这篇关于ubuntu下搭建Go语言(golang)环境的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-04-01got an unexpected keyword argument
- 2024-03-30维多利亚的秘密 golang入坑系统
- 2024-03-29mongodb sort by date
- 2024-03-29go swagger
- 2024-03-25mongodb cdc
- 2024-03-25how to use go in vscode
- 2024-03-22mongooseserverselectionerror: connect econnrefused ::1:27017
- 2024-03-21pymongo insert_many
- 2024-03-18projection mongodb
- 2024-03-14clickhouse-go