golang编译环境安装与helloworld
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
golang作为一门新秀派语言,不仅有良好的家长背景(google爹),而且兼具了c的高效、java的跨平台、python的方便等一系列优点,几乎堪称完美。
今天我们就来分享一下golang的环境搭建与helloworld编写。
1、#wget https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz //需要代理翻墙,下载编译&解析器2、#tar -xvf go1.7.3.linux-amd64.tar.gz -C /usr/local
3、//执行下面两个语句并加入到~/.bash_profile或者 /etc/profile中,并
export GOROOT=/usr/local/go #真实的安装路径[/usr/local]
export GOPATH=/home/gopkg:/home/mcuhome
export PATH=$PATH:$GOROOT/bin
export GOARCH=amd64
export GOOS=linux
#source /etc/profile //更新golang环境变量
#go version //查看golang版本信息
go version go1.6beta1 linux/amd64
4、//第一个go语言程序:hello.go
package main
import "fmt"
func main(){
fmt.Println("Hello World !");
}
编译方法1、
Hello World !
$ go tool compile hello.go #编译hello.go为hello.o
$ go tool link hello.o #链接hello.o为a.out
$ ./a.out #运行
Hello World !
编译方法2、
$ go build hello.go #编译 链接 构建一步完成
$ ./hello #运行helloHello World !




A beautiful web dashboard for Linux
最近提交(Master分支:1 个月前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前

新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。
更多推荐
所有评论(0)