Fix go 1.9.2 & 1.11.4 shows "go mod not found" (#1276)

This commit is contained in:
Ta-Ching Chen
2019-08-20 10:12:48 +08:00
committed by GitHub
parent 7af711a48b
commit 4dccfcc156
+7 -5
View File
@@ -22,16 +22,18 @@ fi
cd ${srcDir}
if [ -f "go.mod" ]; then
if [ ! -z ${GOLANG_VERSION} ] && version_ge ${GOLANG_VERSION} "1.12"; then
if [ ! -z ${GOLANG_VERSION} ] && version_ge ${GOLANG_VERSION} "1.12"; then
if [ -f "go.mod" ]; then
go mod download
else
# still need to do this; otherwise, go will complain "cannot find main module".
go mod init
fi
else # go version lower than go 1.12
if [ -f "go.mod" ]; then
echo "Please update fission/go-builder and fission/go-env image to the latest version to support go module"
exit 1
fi
else
# still need to do this; otherwise, go will complain "cannot find main module".
go mod init
fi
go build -buildmode=plugin -i -o ${DEPLOY_PKG} .