summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-04-13 16:10:09 +0200
committerJakob Unterwurzacher2020-04-13 18:06:50 +0200
commit73436d9419d9ef60b0104a73ffae156d9f871261 (patch)
tree631b30f0750680d562de7f88c55f589ddd4c053e
parenta7d562d1144130f4c12e1eb821ac24210a079e79 (diff)
travis: fix Go Modules build problems
-rw-r--r--.travis.yml6
-rwxr-xr-xbuild.bash9
-rwxr-xr-xcrossbuild.bash3
-rwxr-xr-xtest.bash1
4 files changed, 15 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index 8507326..9cfc238 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,13 @@
language: go
+os: linux
# fuse on travis
sudo: required
dist: bionic # Ubuntu 18.04 "Bionic", https://docs.travis-ci.com/user/reference/bionic/
+env:
+ - GO111MODULE=on
+
git:
depth: 300
@@ -27,7 +31,7 @@ before_install:
script:
- openssl version
- df -Th / /tmp
- - go build
+ - env GO111MODULE=on go build
- ./build-without-openssl.bash
- ./build.bash
- ./gocryptfs -speed
diff --git a/build.bash b/build.bash
index b3e8a7c..afccb72 100755
--- a/build.bash
+++ b/build.bash
@@ -15,7 +15,7 @@ cd "$(dirname "$0")"
# Make sure we have the go binary
go version > /dev/null
-# Make it work on Go 1.11 and 1.12
+# Enable Go Modules on Go 1.11 and 1.12
# https://dev.to/maelvls/why-is-go111module-everywhere-and-everything-about-go-modules-24k#-raw-go111module-endraw-with-go-111-and-112
export GO111MODULE=on
@@ -68,7 +68,12 @@ fi
# Also, Fedora and Arch want pie enabled, so enable it.
# * https://fedoraproject.org/wiki/Changes/golang-buildmode-pie
# * https://github.com/rfjakob/gocryptfs/pull/460
-export GOFLAGS="${GOFLAGS:--trimpath -buildmode=pie}"
+# However, -trimpath needs Go 1.13+, and we support Go 1.11 and Go 1.12
+# too. So don't add it there.
+GV=$(go version)
+if [[ $GV != *"1.11"* && $GV != *"1.12"* ]] ; then
+ export GOFLAGS="${GOFLAGS:--trimpath -buildmode=pie}"
+fi
GO_LDFLAGS="-X main.GitVersion=$GITVERSION -X main.GitVersionFuse=$GITVERSIONFUSE -X main.BuildDate=$BUILDDATE"
diff --git a/crossbuild.bash b/crossbuild.bash
index 12671fe..13b0bc3 100755
--- a/crossbuild.bash
+++ b/crossbuild.bash
@@ -2,13 +2,14 @@
cd "$(dirname "$0")"
+export GO111MODULE=on
B="go build -tags without_openssl"
set -x
# See https://github.com/golang/go/wiki/GoArm
GOOS=linux GOARCH=arm GOARM=7 $B
-GOOS=linux GOARCH=arm64 $B
+GOOS=linux GOARCH=arm64 $B
# MacOS
GOOS=darwin GOARCH=amd64 $B
diff --git a/test.bash b/test.bash
index 6316c1b..ce2d392 100755
--- a/test.bash
+++ b/test.bash
@@ -10,6 +10,7 @@ fi
set -eu
cd "$(dirname "$0")"
+export GO111MODULE=on
MYNAME=$(basename "$0")
TESTDIR=$TMPDIR/gocryptfs-test-parent-$UID
mkdir -p "$TESTDIR"