Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit d07cde0

Browse files
authored
update to go 1.16 (#281)
1 parent 0ac8450 commit d07cde0

File tree

6 files changed

+67
-36
lines changed

6 files changed

+67
-36
lines changed

.travis.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@ env:
3939
- GO111MODULE=on
4040
- GOPROXY=https://proxy.golang.org
4141

42-
# When updating Go versions:
43-
# In addition to changing the "go:" versions below, edit the version
44-
# test in internal/runtests.sh.
45-
4642
jobs:
43+
# When updating Go versions:
44+
# In addition to changing the "go:" versions below, edit the version
45+
# test in ./internal/runtests.sh.
4746
include:
48-
- go: "1.13.x"
47+
- go: "1.15.x"
48+
os: linux
49+
- go: "1.16.x"
4950
os: linux
50-
- go: "1.13.x"
51+
- go: "1.16.x"
5152
os: osx
52-
- go: "1.13.x"
53+
- go: "1.16.x"
5354
os: windows

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ go 1.12
44

55
require (
66
github.com/google/go-cmp v0.2.0
7-
github.com/google/subcommands v1.0.1
7+
github.com/google/subcommands v1.2.0
88
github.com/pmezard/go-difflib v1.0.0
9-
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b
9+
golang.org/x/mod v0.4.1 // indirect
10+
golang.org/x/sys v0.0.0-20210216224549-f992740a1bac // indirect
11+
golang.org/x/tools v0.1.0
1012
)

go.sum

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
11
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
22
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
3-
github.com/google/subcommands v1.0.1 h1:/eqq+otEXm5vhfBrbREPCSVQbvofip6kIz+mX5TUH7k=
4-
github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
3+
github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE=
4+
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
55
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
66
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7+
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
78
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
8-
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
9+
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
10+
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
11+
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
12+
golang.org/x/mod v0.4.1 h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY=
13+
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
14+
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
15+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
16+
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
17+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
18+
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
919
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
10-
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
11-
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
12-
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
20+
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
21+
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
22+
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
23+
golang.org/x/sys v0.0.0-20210216224549-f992740a1bac h1:9glrpwtNjBYgRpb67AZJKHfzj1stG/8BL5H7In2oTC4=
24+
golang.org/x/sys v0.0.0-20210216224549-f992740a1bac/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1325
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
14-
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b h1:NVD8gBK33xpdqCaZVVtd6OFJp+3dxkXuz7+U7KaVN6s=
15-
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
26+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
27+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
28+
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
29+
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
30+
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
31+
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
32+
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
33+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
34+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

internal/alldeps

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
github.com/google/subcommands
22
github.com/google/wire
33
github.com/pmezard/go-difflib
4+
golang.org/x/mod
5+
golang.org/x/sys
46
golang.org/x/tools
7+
golang.org/x/xerrors

internal/check_api_change.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,19 @@ set -euo pipefail
3131
UPSTREAM_BRANCH="${TRAVIS_BRANCH:-master}"
3232
echo "Checking for incompatible API changes relative to ${UPSTREAM_BRANCH}..."
3333

34-
INSTALL_DIR="$(mktemp -d)"
3534
MASTER_CLONE_DIR="$(mktemp -d)"
3635
PKGINFO_BRANCH=$(mktemp)
3736
PKGINFO_MASTER=$(mktemp)
3837

3938
function cleanup() {
40-
rm -rf "$INSTALL_DIR"
4139
rm -rf "$MASTER_CLONE_DIR"
4240
rm -f "$PKGINFO_BRANCH"
4341
rm -f "$PKGINFO_MASTER"
4442
}
4543
trap cleanup EXIT
4644

47-
# Move to a temporary directory while installing apidiff to avoid changing
48-
# the local .mod file.
49-
( cd "$INSTALL_DIR" && exec go mod init unused )
50-
( cd "$INSTALL_DIR" && exec go install golang.org/x/exp/cmd/apidiff )
45+
# Install apidiff.
46+
go install golang.org/x/exp/cmd/apidiff@latest
5147

5248
git clone -b "$UPSTREAM_BRANCH" . "$MASTER_CLONE_DIR" &> /dev/null
5349

internal/runtests.sh

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,26 @@ if [[ "${TRAVIS_OS_NAME:-linux}" != "linux" ]]; then
4141
exit $result
4242
fi
4343

44-
echo
45-
echo "Ensuring .go files are formatted with gofmt -s..."
46-
mapfile -t go_files < <(find . -name '*.go' -type f | grep -v testdata)
47-
DIFF="$(gofmt -s -d "${go_files[@]}")"
48-
if [ -n "$DIFF" ]; then
49-
echo "FAIL: please run gofmt -s and commit the result"
50-
echo "$DIFF";
51-
result=1;
52-
else
53-
echo "OK"
44+
# Update the regexp below when upgrading to a
45+
# new Go version. Some checks below we only run
46+
# for the latest Go version.
47+
latest_go_version=0
48+
if [[ $(go version) == *go1\.16* ]]; then
49+
latest_go_version=1
50+
fi
51+
52+
if [[ ${latest_go_version} -eq 1 ]]; then
53+
echo
54+
echo "Ensuring .go files are formatted with gofmt -s..."
55+
mapfile -t go_files < <(find . -name '*.go' -type f | grep -v testdata)
56+
DIFF="$(gofmt -s -d "${go_files[@]}")"
57+
if [ -n "$DIFF" ]; then
58+
echo "FAIL: please run gofmt -s and commit the result"
59+
echo "$DIFF";
60+
result=1;
61+
else
62+
echo "OK"
63+
fi;
5464
fi;
5565

5666

@@ -59,21 +69,21 @@ fi;
5969
# ./internal/alldeps
6070
#
6171
# Whenever project dependencies change, rerun ./internal/listdeps.sh
62-
if [[ $(go version) == *go1\.12* ]]; then
72+
if [[ ${latest_go_version} -eq 1 ]]; then
6373
echo
6474
echo "Ensuring that there are no dependencies not listed in ./internal/alldeps..."
6575
(./internal/listdeps.sh | diff ./internal/alldeps - && echo "OK") || {
6676
echo "FAIL: dependencies changed; run: internal/listdeps.sh > internal/alldeps"
6777
# Module behavior may differ across versions.
68-
echo "using go version 1.12."
78+
echo "using the latest go version."
6979
result=1
7080
}
7181
fi
7282

7383

7484
# For pull requests, check if there are undeclared incompatible API changes.
7585
# Skip this if we're already going to fail since it is expensive.
76-
if [[ ${result} -eq 0 ]] && [[ ! -z "${TRAVIS_BRANCH:-x}" ]] && [[ ! -z "${TRAVIS_PULL_REQUEST_SHA:-x}" ]]; then
86+
if [[ ${latest_go_version} -eq 1 ]] && [[ ${result} -eq 0 ]] && [[ ! -z "${TRAVIS_BRANCH:-x}" ]] && [[ ! -z "${TRAVIS_PULL_REQUEST_SHA:-x}" ]]; then
7787
echo
7888
./internal/check_api_change.sh || result=1;
7989
fi

0 commit comments

Comments
 (0)