Skip to content

Commit 0c2c289

Browse files
committed
modify test file and enable GO111MODULE
Change commands ran and their order in ./scripts/test to prevent source code from dependencies being pulled in on each build, while still verifying required dependencies. Also enable GO111MODULE in the Dockerfile to allow use of modules while in the $GOPATH.
1 parent 1b41389 commit 0c2c289

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ FROM golang:1.11 AS build
77

88
ENV GOFLAGS='-ldflags=-s -ldflags=-w'
99
ENV CGO_ENABLED=0
10+
ENV GO111MODULE=on
1011

1112
WORKDIR /go/src/github.com/buzzfeed/sso
1213

scripts/test

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ if [ -n "$res" ]; then
1111
exit 1
1212
fi
1313

14-
git diff --exit-code
15-
if [ "$?" -gt "0" ]; then
16-
exit 1
17-
fi
14+
# where necessary attempts to add/remove modules from go.mod and go.sum.
15+
echo "running go mod tidy ..."
16+
go mod tidy
1817

19-
echo "running go mod vendor ..."
20-
go mod vendor
2118
git diff --exit-code
2219
if [ "$?" -gt "0" ]; then
2320
exit 1
2421
fi
2522

23+
# outputs any local suspect modules and, if found will exit
24+
# with a non-zero status.
25+
echo "running go mod verify ..."
26+
go mod verify
27+
2628
echo "running golint ..."
2729
golint -set_exit_status cmd internal
2830

0 commit comments

Comments
 (0)