From 59c8569190e672497849a2187371b4176cc73c0b Mon Sep 17 00:00:00 2001 From: Ta-Ching Chen Date: Thu, 10 Oct 2019 01:44:44 +0800 Subject: [PATCH] Support custom private go vendor (#1346) --- environments/go/builder/build.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/environments/go/builder/build.sh b/environments/go/builder/build.sh index 435dfd47..17310980 100755 --- a/environments/go/builder/build.sh +++ b/environments/go/builder/build.sh @@ -36,4 +36,10 @@ else # go version lower than go 1.12 fi fi -go build -buildmode=plugin -i -o ${DEPLOY_PKG} . +# use vendor mode if the vendor dir exists when go version is greater +# than 1.12 (the version that fission started to support go module). +if [ -d "vendor" ] && [ ! -z ${GOLANG_VERSION} ] && version_ge ${GOLANG_VERSION} "1.12"; then + go build -mod=vendor -buildmode=plugin -i -o ${DEPLOY_PKG} . +else + go build -buildmode=plugin -i -o ${DEPLOY_PKG} . +fi