Skip to content

Commit 72ec69d

Browse files
committed
Add go 1.12 to Travis-CI
Since `go tool vet` is deprecated in Go 1.12, add a hack/verify-govet.sh script that behaves differently for Go 1.{9,10,11}, with the default behavior supporting the new `go vet` for 1.12+.
1 parent 2a8002a commit 72ec69d

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go:
44
- 1.9.x
55
- 1.10.x
66
- 1.11.x
7+
- 1.12.x
78
go_import_path: k8s.io/utils
89
script:
910
- make verify

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ verify-lint:
3030

3131
.PHONY: vet
3232
vet:
33-
go tool vet .
33+
./hack/verify-govet.sh
3434

3535
.PHONY: update-fmt
3636
update-fmt:

hack/verify-govet.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# Copyright 2019 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# For use with Go 1.12+
18+
19+
set -o errexit
20+
set -o nounset
21+
set -o pipefail
22+
23+
GO_VERSION=${TRAVIS_GO_VERSION:-$(go version | cut -d ' ' -f 3)}
24+
25+
if [[ ${GO_VERSION} =~ ^(go)?1\.(9|10|11) ]]; then
26+
go tool vet .
27+
else
28+
go vet ./...
29+
fi

0 commit comments

Comments
 (0)