我从 github 克隆的应用程序很少,但不确定我做的是否正确。我最近安装了 go。
$ 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 但是我仍然需要更改目录并转到我的 go/bin 文件夹..这是所有正在做的还是有我可以改变的东西。如果你能给我指点某种文档就太好了(请不要 go lang!)。
我在 Mac OS X 上。
最佳答案
验证您尝试运行的二进制文件是否在您的 $GOPATH/bin
目录中,例如它应该在你运行 ls $GOPATH/bin
接下来,验证 $GOPATH/bin
是否在您的 $PATH
中,例如它应该与 echo $PATH
一起出现。如果此 $GOPATH/bin
不在您的 $PATH
中,请添加它,例如export PATH=$GOPATH/bin:$PATH
(您可能希望将其添加到您的 .bashrc
)。
关于Go 语言环境和路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39172215/