go get命令不提供输出也不生效

gg0vcinb  于 2023-05-04  发布在  Go
关注(0)|答案(3)|浏览(143)

我已经在我的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
6ojccjat

6ojccjat1#

$ 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.

$

如果没有什么可做的,那就没有什么可报告的。例如,当go get第一次运行时,它下载并安装,之后它什么也不做,因为没有什么可做的,除非你强制更新:

$ 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 
$
6fe3ivhb

6fe3ivhb2#

我相信你现在已经解决了这个问题,但是如果这能帮助其他人,你应该检查你的“$GOTOOLDIR”,这是“go get”将要安装的地方。
类型

go env

并检查您的GOTOOLDIR是一个应该是您希望安装go get的地方。

zzoitvuj

zzoitvuj3#

如果启用了go work,则需要将repo添加到go工作文件中。
从您正在使用的目录:

go work use .

相关问题