我无法安装 bleve,因为它提示 zap:
去 github.com/blevesearch/bleve/...
package github.com/blevesearch/zap/v11: cannot find package "github.com/blevesearch/zap/v11" in any of:
/usr/local/go/src/github.com/blevesearch/zap/v11 (from $GOROOT)
/home/w/go/src/github.com/blevesearch/zap/v11 (from $GOPATH)
package github.com/blevesearch/zap/v12: cannot find package "github.com/blevesearch/zap/v12" in any of:
/usr/local/go/src/github.com/blevesearch/zap/v12 (from $GOROOT)
/home/w/go/src/github.com/blevesearch/zap/v12 (from $GOPATH)
package github.com/blevesearch/zap/v13: cannot find package "github.com/blevesearch/zap/v13" in any of:
/usr/local/go/src/github.com/blevesearch/zap/v13 (from $GOROOT)
/home/w/go/src/github.com/blevesearch/zap/v13 (from $GOPATH)
我可以通过 gopkg.in/blevesearch/zap.v13 获取它,但 bleve 本身正在引用它。我的 GOPATH 未设置。去环境:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/w/.cache/go-build"
GOENV="/home/w/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="freebsd"
GOPATH="/home/w/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/freebsd_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build443146450=/tmp/go-build -gno-record-gcc-switches"
最佳答案
我遇到了同样的问题,发现 bleve 现在需要启用 Go 模块。我看到,在您的环境中,Go 模块( GO111MODULE
)未启用。您需要通过在 .bashrc
中添加这一行来启用 Go 模块(或等效)文件。
export GO111MODULE=on
或者你可以在安装bleve的时候直接在命令中使用。GO111MODULE="on" go get -u github.com/blevesearch/bleve/...
但是,如果您在命令行中使用它并且不要输入您的 .bashrc
文件,您可能需要在 go run
时使用它或 go build
.因此,将其添加到 .bashrc
会有所帮助.欲了解更多信息,check out this RFC .
关于go - 无法安装bleve,在任何一个中都找不到包 "github.com/blevesearch/zap/v11",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62959090/