Life Since 1985

Happy Hacking

GO语言环境设置

david kei posted @ 2010年8月14日 06:20 in GO with tags go , 2182 阅读

对于GO语言我也是今天闲着没事装上玩玩,按照GO语言官方文档的安装方法大体都能够安装上,不过有很多细节上面说的不是很清楚,而且有很多地方有可能在当前GO的版本上已经有所更改,所以特地写出来以供大家一起研究。

首先介绍一下我的环境:Ubuntu amd64

1.Go语言需要设置四个环境变量:

GOROOT:一般设置为$HOME/go,这个是GO安装包的根目录,一般的安装文件都下载在这里。

GOARCH:这个标识出系统的架构,即为386、amd64或是arm

GOOS:这个标识出操作系统类型,即为linux、freeBSD、darwin等等

GOBIN:一般设置为$HOME/bin,指明GO编译后安装的二进制目录。这个在官方的文档中写的是可选,但是在真正的安装过程中发现是必须要设置的,不知道是否是因为系统、架构的原因有所不同。

2.编译.bashrc,在里面设置好环境变量:

export GOROOT=$HOME/go  
export GOARCH=amd64  
export GOOS=linux  
export GOBIN=$HOME/bin
export PATH=${PATH}:$HOME/bin  

设置好之后可以通过以下命令查看是否设置成功

env | grep '^GO'

3.安装一些必要的工具

(1)安装Mercurial版本管理系统

sudo apt-get install mercurial

(2)安装GCC、C标准库、Bison分析器、 以及make、awk和ed等开发工具

sudo apt-get install bison gcc libc6-dev ed gawk make

4.下载GO的源文件

hg clone -r release https://go.googlecode.com/hg/ $GOROOT

通过以下命令对GO进行编译

cd $GOROOT/src
./all.bash

如果编译成功会在终端中显示如下信息

--- cd ../test
N known bugs; 0 unexpected bugs

基本上到现在为止GO语言环境已经编译并设置好了。

 

Avatar_small
bigzhu 说:
2010年8月16日 00:34

恩,有空的时候装一个玩玩

NCERT Biology Questi 说:
2022年9月27日 20:06

Those Class 6th Standard students who have interested in getting the best score in Term-1& Term-2 exams can download the NCERT STD-6 Biology Sample Paper 2023 Pdf with Suggested answers that support Hindi Medium, English Medium, and Urdu Medium Students for SA1, SA2, FA1, FA2, FA3, FA4, NCERT Biology Question Paper Class Assignments and other types of exams which are conducted under the board or school level.Those Class 6th Standard students who have interested in getting the best score in Term-1& Term-2 exams can download the NCERT STD-6 Biology Sample Paper 2023 Pdf with Suggested answers that support Hindi Medium.

emma 说:
2022年12月19日 03:01

On a Windows operating system, the GO locale settings can be found in the "Control Panel". To change CBD For Drug Addiction the GO locale settings, first click on "Regional and Language Options", then click on the "Location" tab. From here, you can select your desired GO locale settings.

Alyssa 说:
2022年12月20日 05:48

"When developing Go applications, you may need to set the locale settings for your application. This can be done using the ""setlocale"" function. This function real estate agencies Orcutt takes two arguments: the category and the locale. The category can be one of the following: LC_ALL: All of the following categories LC_COLLATE: Collation LC_CTYPE: Character classification LC_MONETARY: Monetary formatting LC_NUMERIC: Numeric formatting LC_TIME: Time formatting The locale argument is a string that specifies the desired locale. For example, to set the locale to U.S. English, you would use the string ""en_US"". "


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter