Skip to content

Commit

Permalink
tests/unit/go: allow skipping of gofmt checks on 19.10
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bboozzoo committed Sep 13, 2019
1 parent 20fba42 commit 933d779
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/unit/go/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 933d779

Please sign in to comment.