英文:
go get command does not provide output nor take effect
问题
我在我的Mac上安装了Go。
go version的输出结果是:
go version go1.8.1 darwin/amd64
以及
go env的输出结果是:
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/MYUSERNAME/go/"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/np/ts5bwp_91ns22l9h751h2j8r0000gn/T/go-build124313959=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
当我运行以下go get命令时:
go get -v github.com/miku/esbulk/cmd/esbulk
它既没有生成任何输出,也没有做任何事情。什么都没有发生。
更新1
在GOPATH/pkg文件夹中有一个darwin_amd64文件夹,在darwin_amd64文件夹中有:
github.com/miku/esbulk.a
英文:
I have installed go on my mac
go version
output:
go version go1.8.1 darwin/amd64
AND
go env
output:
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/MYUSERNAME/go/"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/np/ts5bwp_91ns22l9h751h2j8r0000gn/T/go-build124313959=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
when I ran the following go get command:
go get -v github.com/miku/esbulk/cmd/esbulk
it neither generating any output nor does anything. Just nothing happened.
Update 1
in GOPATH/pkg folder there is darwin_amd64 folder, in darwin_amd64 folder there is
github.com/miku/esbulk.a
答案1
得分: 16
$ go help get
用法:go get [-d] [-f] [-fix] [-insecure] [-t] [-u] [构建标志] [包]
Get 命令会下载由导入路径指定的包及其依赖项。然后,它会像 'go install' 一样安装这些包。
-u 标志指示 get 命令使用网络更新指定的包及其依赖项。默认情况下,get 命令会使用网络检出缺失的包,但不会使用网络查找现有包的更新。
-v 标志启用详细的进度和调试输出。
如果没有要执行的操作,则不会有任何报告。例如,当首次运行 'go get' 时,它会下载并安装包,之后它不会执行任何操作,除非你强制更新:
$ go get -v github.com/aclements/perflock/cmd/perflock
github.com/aclements/perflock (下载)
github.com/aclements/perflock/internal/cpupower
github.com/aclements/perflock/cmd/perflock
$ go get -v github.com/aclements/perflock/cmd/perflock
$ go get -v github.com/aclements/perflock/cmd/perflock
$ go get -v -u github.com/aclements/perflock/cmd/perflock
github.com/aclements/perflock (下载)
$ go get -v -u github.com/aclements/perflock/cmd/perflock
github.com/aclements/perflock (下载)
$ go get -v github.com/aclements/perflock/cmd/perflock
$ go get -v github.com/aclements/perflock/cmd/perflock
$
英文:
$ go help get
usage: go get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages]
Get downloads the packages named by the import paths, along with their
dependencies. It then installs the named packages, like 'go install'.
The -u flag instructs get to use the network to update the named packages
and their dependencies. By default, get uses the network to check out
missing packages but does not use it to look for updates to existing packages.
The -v flag enables verbose progress and debug output.
$
If there is nothing to do then there is nothing to report. For example, when go get
is run for the first time it downloads and installs, after that it does nothing because there is nothing to do, unless you force an update:
$ go get -v github.com/aclements/perflock/cmd/perflock
github.com/aclements/perflock (download)
github.com/aclements/perflock/internal/cpupower
github.com/aclements/perflock/cmd/perflock
$ go get -v github.com/aclements/perflock/cmd/perflock
$ go get -v github.com/aclements/perflock/cmd/perflock
$ go get -v -u github.com/aclements/perflock/cmd/perflock
github.com/aclements/perflock (download)
$ go get -v -u github.com/aclements/perflock/cmd/perflock
github.com/aclements/perflock (download)
$ go get -v github.com/aclements/perflock/cmd/perflock
$ go get -v github.com/aclements/perflock/cmd/perflock
$
答案2
得分: 1
我确定你现在已经解决了那个问题,但如果这能帮助其他人,你应该检查一下你的"$GOTOOLDIR",这是"go get"将要安装的位置。
输入以下命令:
go env
并检查你的GOTOOLDIR是否是你希望安装"go get"的位置。
英文:
I'm sure you solve that issue by now, but if that can help others, you shold check your "$GOTOOLDIR" which is where the "go get" are going to be installed.
Type
go env
And check that your GOTOOLDIR is the one that should be where you want the go get to be installed.
答案3
得分: 0
如果你启用了go work
,你需要将该仓库添加到你的go work文件中。
从你正在使用的目录开始:
go work use .
英文:
If you have go work
enabled, you'll need to add the repo to your go work file.
From the directory you are using:
go work use .
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论