diff options
| author | Maciej Borzecki <maciej.zenon.borzecki@canonical.com> | 2019-09-13 09:41:50 +0200 |
|---|---|---|
| committer | Maciej Borzecki <maciej.zenon.borzecki@canonical.com> | 2019-09-13 09:41:50 +0200 |
| commit | 933d779795fb66906ff20ff8d5845d56019378ba (patch) | |
| tree | 972f335880b821f2b9484145108faa0fba974368 /tests/unit | |
| parent | 20fba426001a1744090524b005ccb4f82679487e (diff) | |
tests/unit/go: allow skipping of gofmt checks on 19.10
Ubuntu 19.10 comes with Go 1.11 where gofmt produces formatting that is incompatible with earlier releases. However, we enforce go 1.10 formatting rules on Travis. Allow gofmt checks to be skipped on these systems. Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/go/task.yaml | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/unit/go/task.yaml b/tests/unit/go/task.yaml index 95f1fb999f..90c7f8bec7 100644 --- a/tests/unit/go/task.yaml +++ b/tests/unit/go/task.yaml @@ -18,7 +18,18 @@ execute: | rm -r /tmp/static-unit-tests/src/github.com/snapcore/snapd/vendor/*/ rm -rf /tmp/static-unit-tests/src/github.com/snapcore/snapd/cmd/{autom4te.cache,configure,test-driver,config.status,config.guess,config.sub,config.h.in,compile,install-sh,depcomp,build,missing,aclocal.m4,Makefile,Makefile.in} - su -l -c "cd /tmp/static-unit-tests/src/github.com/snapcore/snapd && PATH=$PATH GOPATH=/tmp/static-unit-tests ./run-checks --static" test + if [[ "$SPREAD_SYSTEM" == ubuntu-19.10-* ]]; then + # the code is formatted according to gofmt 1.10 rules, but those changed + # in later releases; skip gofmt checks on systems where go is known to + # be newer and produce incompatible formatting + skip='SKIP_GOFMT=1' + fi + + su -l -c "cd /tmp/static-unit-tests/src/github.com/snapcore/snapd && \ + PATH=$PATH GOPATH=/tmp/static-unit-tests \ + ${skip:-} \ + ./run-checks --static" test + su -l -c "cd /tmp/static-unit-tests/src/github.com/snapcore/snapd && \ TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER \ TRAVIS_BRANCH=$TRAVIS_BRANCH \ |
