Reputation: 161
I'm working in Go version 1.8, Glide for package dependency and my project structure is
/Users/myName/go
bin/
pkg/
src/
main.go
vendor/
github.com/
gaoling.org/
all my packages are installed in vendor folder after doing glide install
, when I do go build
it is giving following error
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)
and go env
is
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"
Upvotes: 2
Views: 1608
Reputation: 964
The glide works the old way, So you need to move your code to the folder /Users/myName/go/src/github.com/projectName
and run glide. Your main.go and vendor file should come under your projectName folder.
Upvotes: 0