Skip to content

Commit d8fb947

Browse files
authored
update min supported version to 1.15 (golang#641)
1 parent 32e424a commit d8fb947

17 files changed

+159
-309
lines changed

.github/workflows/test.yaml

+4-13
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
test:
1111
strategy:
1212
matrix:
13-
go-version: [1.11.x, 1.17.x]
13+
go-version: [1.15.x, 1.18.x]
1414
os: [ubuntu-latest]
1515
runs-on: ${{ matrix.os }}
1616
steps:
@@ -23,27 +23,18 @@ jobs:
2323
- name: Checkout code
2424
uses: actions/checkout@v2
2525

26-
# Needed for versions <1.14 tests
27-
- name: Install mock
28-
run: |
29-
GO111MODULE=off go get github.com/golang/mock | true
30-
3126
- name: Vet and build
3227
run: |
3328
go vet ./...
3429
go build ./...
3530
36-
- name: Install tools
31+
- name: Install mockgen
3732
run: |
3833
go install github.com/golang/mock/mockgen
39-
GO111MODULE=off go get -u golang.org/x/lint/golint
4034
41-
- name: Run test scripts
35+
- name: Run test script
4236
run: |
43-
./ci/check_go_fmt.sh
44-
./ci/check_go_lint.sh
45-
./ci/check_go_generate.sh
46-
./ci/check_go_mod.sh
37+
./ci/test.sh
4738
./ci/check_panic_handling.sh
4839
4940
- name: Run Go tests

ci/check_go_fmt.sh

-12
This file was deleted.

ci/check_go_generate.sh

-33
This file was deleted.

ci/check_go_lint.sh

-17
This file was deleted.

ci/check_go_mod.sh

-18
This file was deleted.

ci/test.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
# This script is used to ensure that the go.mod file is up to date.
3+
4+
set -euo pipefail
5+
6+
if [[ $(go version) != *"go1.18"* ]]; then
7+
exit 0
8+
fi
9+
10+
for i in $(find $PWD -name go.mod); do
11+
pushd $(dirname $i)
12+
go mod tidy
13+
popd
14+
done
15+
16+
if [ ! -z "$(git status --porcelain)" ]; then
17+
git status
18+
git diff
19+
echo
20+
echo "The go.mod is not up to date."
21+
exit 1
22+
fi
23+
24+
BASE_DIR="$PWD"
25+
TEMP_DIR=$(mktemp -d)
26+
function cleanup() {
27+
rm -rf "${TEMP_DIR}"
28+
}
29+
trap cleanup EXIT
30+
31+
cp -r . "${TEMP_DIR}/"
32+
cd $TEMP_DIR
33+
34+
for i in $(find $PWD -name go.mod); do
35+
pushd $(dirname $i)
36+
go generate ./...
37+
popd
38+
done
39+
40+
if ! diff -r . "${BASE_DIR}"; then
41+
echo
42+
echo "The generated files aren't up to date."
43+
echo "Update them with the 'go generate ./...' command."
44+
exit 1
45+
fi

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ require (
55
golang.org/x/tools v0.1.8
66
)
77

8-
go 1.11
8+
go 1.15

gomock/controller_113_test.go

-29
This file was deleted.

gomock/controller_114_test.go

-133
This file was deleted.

0 commit comments

Comments
 (0)