安装与酿造,并运行gotour [英] Install go with brew, and running the gotour

查看:151
本文介绍了安装与酿造,并运行gotour的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循 http://tour.golang.org/ ,直到第三步告诉你你可以在你的系统上安装gotour。
在此之后,我已经安装了go语言,其中包含:

I was following the http://tour.golang.org/ untill I got to the third step about that tells you that you can install the gotour on your system. After that I've installed the go language with brew by:

brew install hg
brew install go

然后我下载了这个gotour:

Then I downloaded the gotour by:

go get code.google.com/p/go-tour/gotour

当我尝试启动gotour时,它并未识别该命令:

When I tried to launch the gotour it didnt recognise the command:

$ gotour
-bash: gotour: command not found

$ go gotour

$ ./gotour

所以我试图看到去的路径,它是空的,

So I tried to see the go path and it was empty,

echo $GOPATH

所以我定义了GOPATH:

so I defined the GOPATH:

GOPATH=/usr/local/Cellar/go/1.0.2/src/pkg/code.google.com/p/
export GOPATH

现在我可以运行gototour

Now I can run the gotour by runing

./gotour

但是我对自己的环境没有保障..不是因为我可以运行gotot by

But I'm insecure about my go enviroment.. wasn't I suposed to be able to run gotour by

go run gotour

在这个网站上 http://www.moncefbelyamani.com/how- )

or just by typing (like is described on this website http://www.moncefbelyamani.com/how-to-install-the-go-tour-on-your-mac/):

gotour

我想知道如果我是正确的做法,因为我是新手编程语言。

I would like to know if i'm doing things the right way since I'm new to the go programing language.

推荐答案

在OSX上安装go 1.4与homebrew:



1 )创建目录



Installing go 1.4 with homebrew on OSX:

1) Create Directories

mkdir $HOME/Go
mkdir -p $HOME/Go/src/github.com/user



2)设置路径

2) Setup your paths

export GOPATH=$HOME/Go
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin



3)安装Go



3) Install Go

brew install go



4)go get



4) "go get" the basics

go get golang.org/x/tools/cmd/godoc

这篇关于安装与酿造,并运行gotour的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆