2016-08-26 43 views
-3

我有幾個從github克隆的應用程序,但不知道我是否做的都對。我最近安裝去了。轉到lang環境和路徑

$ go 
Go is a tool for managing Go source code. 

Usage: 

     go command [arguments] 

The commands are: 

     build  compile packages and dependencies 
     clean  remove object files 
     doc   show documentation for package or symbol 
     env   print Go environment information 
     fix   run go tool fix on packages 
     fmt   run gofmt on package sources 
     generate generate Go files by processing source 
     get   download and install packages and dependencies 
     install  compile and install packages and dependencies 
     list  list packages 
     run   compile and run Go program 
     test  test packages 
     tool  run specified go tool 
     version  print Go version 
     vet   run go tool vet on packages 

Use "go help [command]" for more information about a command. 

Additional help topics: 

     c   calling between Go and C 
     buildmode description of build modes 
     filetype file types 
     gopath  GOPATH environment variable 
     environment environment variables 
     importpath import path syntax 
     packages description of package lists 
     testflag description of testing flags 
     testfunc description of testing functions 

Use "go help [topic]" for more information about that topic. 

而且我已經配置了相應的東西(出口變量等)也加入到他們的〜/ .bashrc但是我還需要更改目錄去我去/ bin文件夾..這算什麼都是做或有些事情我可以改變。如果你能指出我的某種文檔,那將是非常好的。

我在Mac OS X

+0

你是不是想執行編譯去二進制文件? –

+0

是的,我是!例如$ minio server/somefolder – Evgeny

回答

1

確認您要運行的二進制在你$GOPATH/bin目錄,例如它應該在您運行時出現ls $GOPATH/bin

接下來,驗證$GOPATH/bin是否在您的$PATH中,例如,它應該與echo $PATH一起出現。如果$GOPATH/bin不在您的$PATH中,請將其添加export PATH=$GOPATH/bin:$PATH(您可能希望將此添加到您的.bashrc)。

+1

PATH應該從.profile或.bash_profile導出,而不是.bashrc。 – JimB

-2

您可以運行go env看到你$GOPATH和一些環境變量

0

在Mac OS X,打開終端

創建.profile文件

touch .profile

編輯

vim .profile

添加到您的第一線

export GOPATH=$HOME/work/或任何目錄中轉到文件在

保存:w並退出:q

重啓終端

更改爲新GOPATH/bin目錄,以確認

cd $GOPATH/bin