我正在使用 Go 版本 1.8,Glide 用于包依赖,我的项目结构是
/Users/myName/go
bin/
pkg/
src/
main.go
vendor/
github.com/
gaoling.org/
完成后我所有的软件包都安装在供应商文件夹中glide install
,当我这样做时go build
出现以下错误
main.go:7:2: cannot find package "github.com/julienschmidt/httprouter" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/julienschmidt/httprouter (from $GOROOT)
/Users/myName/go/src/github.com/julienschmidt/httprouter (from $GOPATH)
并且go env
是
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/myName/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.8.1/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.8.1/libexec/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/st/28pcgmmj1sb84ch1n_76g_k00000gn/T/go-build454728554=/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"