Mac环境 go语言之入门HelloWorld
来源:互联网 发布:唐山学院网络教育平台 编辑:程序博客网 时间:2024/05/16 02:39
1. 安装mercurial
Mercurial 是一种轻量级分布式版本控制系统,采用 Python 语言实现
可以输入hg命令查询系统是否安装mercurial,可以如下两种命令安装
$sudo pip install mercurial
安装成功之后
$sudo easy-install mercurial
安装之后,输入hg命令,如下内容显示,表示成功安装 mercuria
$ hg
Mercurial Distributed SCM
basic commands:
add add the specified files on the next commit
annotate show changeset information by line for each file
clone make a copy of an existing repository
commit commit the specified files or all outstanding changes
diff diff repository (or selected files)
export dump the header and diffs for one or more changesets
forget forget the specified files on the next commit
init create a new repository in the given directory
log show revision history of entire repository or files
merge merge working directory with another revision
pull pull changes from the specified source
push push changes to the specified destination
remove remove the specified files on the next commit
serve start stand-alone webserver
status show changed files in the working directory
summary summarize working directory state
update update working directory (or switch revisions)
use "hg help" for the full list of commands or "hg -v" for details
如上命令安装失败,可以直接去下载安装
2. 获取go源代码
$hg clone -r release https://go.googlecode.com/hg/ go
warning: go.googlecode.com certificate with fingerprint 3f:8a:ae:12:fc:c2:65:d0:64:42:ee:6f:cc:b3:41:a1:9a:76:6e:8c not verified (check hostfingerprints or web.cacerts config setting)
adding changesets
adding manifests
adding file changes
added 19559 changesets with 68116 changes to 8835 files
updating to branch release-branch.go1.3
4167 files updated, 0 files merged, 0 files removed, 0 files unresolved
会在当前路径创建go目录
3.安装go
进入 go源码(go/src)目录进行安装,执行如下命令
$ ./all.bash
最后会显示出如下内容
ALL TESTS PASSED
---
Installed Go for darwin/amd64 in /Users/angel/iProject/go
Installed commands in /Users/angel/iProject/go/bin
*** You need to add /Users/angel/iProject/go/bin to your PATH.
4.编写HelloWorld
$ cat helloworld.go
package main
import (
"fmt"
)
func main(){
fmt.Println("Hello World")
}
5.运行程序
$ go run helloworld.go
Hello World
参考 链接
- Mac环境 go语言之入门HelloWorld
- Go语言入门系列之安装及HelloWorld
- GO语言基础环境搭建以及HelloWorld
- mac系统下搭建go语言环境
- Mac下搭建go语言开发环境
- Go语言Mac开发环境配置
- Go语言之环境搭建
- GO语言 HelloWorld
- ubuntu下,GO语言环境的搭建及helloworld
- go语言的环境搭建,永远的HelloWorld
- go语言快速入门:第一个HelloWorld(2)
- go语言快速入门:Web应用的HelloWorld(11)
- linux入门-go语言环境搭建
- 《Go语言入门》第一个Go语言程序——HelloWorld
- React入门之HelloWorld及环境搭建
- Android入门之环境搭建-helloworld
- R语言mac helloworld
- 初学Go语言之环境搭建
- 蓝的成长记——追逐DBA(7):基础命令,地基之石
- IOS Layer的使用
- qt for android实现程序的开机自启动。
- zoj 2391 Beautiful People 最长上升子序列
- hdu1827——Summer Holiday
- Mac环境 go语言之入门HelloWorld
- 【Manacher】 POJ 3974 Palindrome
- 【Android开发经验】关于dip、dpi和分辨率的一些事
- OpenGL超级宝典总结(二)2D/3D笛卡尔坐标、坐标裁剪、纹理坐标、MVP转换
- HDU 5044 Tree(树链剖分)
- BW:处理链报错解决步骤
- 笔试题一,计算机网络,操作系统
- LinearLayout、RelativeLayout、FrameLayout居中显示
- VSS2005的配置过程