我遇到了 Go 1.11.4 的問題,忽略了vendor我所在項目的目錄。嘗試運行各種命令時,我收到以下錯誤,即使引用的路徑清楚地存在于 vendor 目錄中。錯誤消息本身似乎表明該vendor目錄甚至沒有被查看,至少對于這個應(yīng)該找不到的項目來說是這樣。到底發(fā)生了什么,我該如何解決這個問題?下面是來自終端的直接復(fù)制/粘貼,在一些pbpaste | sed "s#…#R#g;s#…#M#g;s#…#D#g;s#…#B#g;s#…#example.org#g;s#^#printf \t#g" | pbcopy腳本之后匿名存儲庫。ubuntu:R {607} go versiongo version go1.11.4 linux/amd64ubuntu:R {608} go build | & head -4server.go:10:2: cannot find package "example.org/M/B" in any of: /usr/local/go/src/example.org/M/B (from $GOROOT) /home/ubuntu/go/src/example.org/M/B (from $GOPATH)R.go:8:2: cannot find package "example.org/M/D" in any of:ubuntu:R {609} ll vendor/example.org/M/B/total 284 -rw-r--r-- 1 ubuntu ubuntu 156 Jan 10 17:57 .drone.yml8 -rw-r--r-- 1 ubuntu ubuntu 6207 Jan 10 17:57 Gopkg.lock4 -rw-r--r-- 1 ubuntu ubuntu 798 Jan 10 17:57 Gopkg.toml4 -rw-r--r-- 1 ubuntu ubuntu 53 Jan 10 17:57 README.md8 -rw-r--r-- 1 ubuntu ubuntu 4783 Jan 10 17:57 B.goubuntu:R {610} go envGOARCH="amd64"GOBIN=""GOCACHE="/home/ubuntu/.cache/go-build"GOEXE=""GOFLAGS=""GOHOSTARCH="amd64"GOHOSTOS="linux"GOOS="linux"GOPATH="/home/ubuntu/go"GOPROXY=""GORACE=""GOROOT="/usr/local/go"GOTMPDIR=""GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"GCCGO="gccgo"CC="gcc"CXX="g++"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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build981837178=/tmp/go-build -gno-record-gcc-switches"ubuntu:R {611}
Go 1.11 忽略了 `vendor` 目錄,錯誤給人的印象是該目錄從未被看過
幕布斯7119047
2023-06-01 14:36:11