Answer the question
In order to leave comments, you need to log in
How to configure GOPATH to use Vendor?
There is a project written in go. For the convenience of dependencies, I use glide, or rather, at the moment I change the vendor structure and add a directory to GOPATH.
There is a dependency in glide.yml :
- package: github.com/go-sql-driver/mysql
version: ^1.4.0
import (_ "github.com/go-sql-driver/mysql"
| root
| src/
| go files
| vendor/
| doc-files
mkdir -p src/vendor_new/src
mv src/vendor/* src/vendor_new/src
rm -r src/vendor
mv src/vendor_new src/vendor
export GOPATH="$GOPATH:$(pwd):$(pwd)/src/vendor"
# Installing build dependencies. You will need to run this once manually when you clone the repo
depend:
go get -v $(DEPEND)
cd src && rm -rf vendor || true && glide install && && mkdir -p vendor_new/src && mv vendor/* vendor_new/src && rm -r vendor && mv vendor_new vendor && cd ..
$ uname -a
Linux localhost.localdomain 4.17.11-200.fc28.x86_64 #1 SMP Mon Jul 30 15:21:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ go version
go version go1.10.3 linux/amd64
[]$ go env
GOARCH="amd64"
GOBIN="/home/user/go/bin"
GOCACHE="/home/user/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/go:/projects/go-project:/projects/go-project/src/vendor"
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build031255179=/tmp/go-build -gno-record-gcc-switches"
Answer the question
In order to leave comments, you need to log in
For a dependency lock, I advise you to start using https://github.com/golang/dep . This is the official dependency manager and is easy to use.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question