Support GOPATH mode build/test for its transitional situation

This commit is contained in:
Tomofumi Hayashi
2019-06-14 15:30:11 +09:00
committed by Tomofumi Hayashi
parent ac21a96804
commit d134ac8485
2 changed files with 42 additions and 6 deletions

20
test.sh
View File

@@ -1,7 +1,23 @@
#!/usr/bin/env bash
set -e
export GO111MODULE=on
# this if... will be removed when gomodules goes default
if [ $GO111MODULE == "off" ]; then
echo "Warning: this will be deprecated in near future so please use go modules!"
bash -c "umask 0; go test -v -covermode=count -coverprofile=coverage.out ./..."
ORG_PATH="github.com/intel"
REPO_PATH="${ORG_PATH}/multus-cni"
if [ ! -h gopath/src/${REPO_PATH} ]; then
mkdir -p gopath/src/${ORG_PATH}
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi
export GO15VENDOREXPERIMENT=1
export GOBIN=${PWD}/bin
export GOPATH=${PWD}/gopath
bash -c "umask 0; cd ${GOPATH}/src/${REPO_PATH}; PATH=${GOROOT}/bin:$(pwd)/bin:${PATH} go test -v -covermode=count -coverprofile=coverage.out ./..."
else
# test with go modules
bash -c "umask 0; go test -v -covermode=count -coverprofile=coverage.out ./..."
fi