我從 github 克隆的應用程序很少,但不確定我是否做對了所有事情。我最近安裝了go。$ goGo 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 packagesUse "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 functionsUse "go help [topic]" for more information about that topic.而且我已經相應配置了一些東西(導出的變量等。)也將它們添加到 ~/.bashrc 但是我仍然需要更改目錄并轉到我的 go/bin 文件夾。這是所有正在做的事情還是我可以做的事情改變。如果您能在某種文檔上指出我,那就太好了(請不要去朗讀?。?。我在 Mac OS X 上。
2 回答

千萬里不及你
TA貢獻1784條經驗 獲得超9個贊
驗證您嘗試運行的二進制文件是否在您的$GOPATH/bin
目錄中,例如它應該在您運行時出現ls $GOPATH/bin
接下來,驗證它$GOPATH/bin
是否在您的 中$PATH
,例如它應該與 一起出現echo $PATH
。如果這$GOPATH/bin
不在您的 中$PATH
,請添加它,例如export PATH=$GOPATH/bin:$PATH
(您可能希望將其添加到您的 中.bashrc
)。

繁星淼淼
TA貢獻1775條經驗 獲得超11個贊
在 Mac OS X 中,打開終端
創建一個 .profile 文件
touch .profile
編輯它
vim .profile
將此添加到您的第一行
export GOPATH=$HOME/work/
或您的 Go 文件所在的任何目錄
保存:w
并退出:q
重啟終端
切換到新的 GOPATH/bin 目錄以確認
cd $GOPATH/bin
- 2 回答
- 0 關注
- 181 瀏覽
添加回答
舉報
0/150
提交
取消