Skip to content

Commit 7547e83

Browse files
michael-keparis
authored andcommitted
Run tests against go 1.11 and drop 1.9 (#737)
* Update the Travis and CircleCI Go versions * Adapt to new gofmt formatting The formatting of gofmt changed slightly in go 1.11. The release notes recommend to use a specific binary of gofmt. See https://golang.org/doc/go1.11#gofmt This commit adapts to the new formatting applied by gofmt and changes the configs for travis and circleci to run gofmt only with go 1.11.
1 parent d2d81d9 commit 7547e83

File tree

3 files changed

+49
-33
lines changed

3 files changed

+49
-33
lines changed

.circleci/config.yml

+44-29
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,53 @@
1-
workflows:
2-
version: 2
3-
main:
4-
jobs:
5-
- go-current
6-
- go-previous
7-
- go-latest
8-
base: &base
9-
working_directory: /go/src/github.com/spf13/cobra
10-
steps:
11-
- checkout
12-
- run:
13-
name: "All Commands"
14-
command: |
15-
mkdir -p bin
16-
curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.6/shellcheck
17-
chmod +x bin/shellcheck
18-
go get -t -v ./...
19-
PATH=$PATH:$PWD/bin go test -v ./...
20-
go build
21-
diff -u <(echo -n) <(gofmt -d -s .)
22-
if [ -z $NOVET ]; then
23-
diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
24-
fi
251
version: 2
2+
3+
references:
4+
workspace: &workspace
5+
/go/src/github.com/spf13/cobra
6+
7+
run_tests: &run_tests
8+
run:
9+
name: "All Commands"
10+
command: |
11+
mkdir -p bin
12+
curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.6/shellcheck
13+
chmod +x bin/shellcheck
14+
go get -t -v ./...
15+
PATH=$PATH:$PWD/bin go test -v ./...
16+
go build
17+
if [ -z $NOVET ]; then
18+
diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
19+
fi
20+
2621
jobs:
2722
go-current:
2823
docker:
29-
- image: circleci/golang:1.10.0
30-
<<: *base
24+
- image: circleci/golang:1.11
25+
working_directory: *workspace
26+
steps:
27+
- checkout
28+
- *run_tests
29+
- run:
30+
name: "Check formatting"
31+
command: diff -u <(echo -n) <(gofmt -d -s .)
3132
go-previous:
3233
docker:
33-
- image: circleci/golang:1.9.4
34-
<<: *base
34+
- image: circleci/golang:1.10
35+
working_directory: *workspace
36+
steps:
37+
- checkout
38+
- *run_tests
3539
go-latest:
3640
docker:
3741
- image: circleci/golang:latest
38-
<<: *base
42+
working_directory: *workspace
43+
steps:
44+
- checkout
45+
- *run_tests
46+
47+
workflows:
48+
version: 2
49+
main:
50+
jobs:
51+
- go-current
52+
- go-previous
53+
- go-latest

.travis.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ language: go
22

33
matrix:
44
include:
5-
- go: 1.9.4
6-
- go: 1.10.0
5+
- go: 1.10.x
6+
- go: 1.11.x
77
- go: tip
8+
- go: 1.11.x
9+
script: diff -u <(echo -n) <(gofmt -d -s .)
810
allow_failures:
911
- go: tip
1012

@@ -15,7 +17,6 @@ before_install:
1517
script:
1618
- PATH=$PATH:$PWD/bin go test -v ./...
1719
- go build
18-
- diff -u <(echo -n) <(gofmt -d -s .)
1920
- if [ -z $NOVET ]; then
2021
diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
2122
fi

bash_completions_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestBashCompletions(t *testing.T) {
7171
ArgAliases: []string{"pods", "nodes", "services", "replicationcontrollers", "po", "no", "svc", "rc"},
7272
ValidArgs: []string{"pod", "node", "service", "replicationcontroller"},
7373
BashCompletionFunction: bashCompletionFunc,
74-
Run: emptyRun,
74+
Run: emptyRun,
7575
}
7676
rootCmd.Flags().IntP("introot", "i", -1, "help message for flag introot")
7777
rootCmd.MarkFlagRequired("introot")

0 commit comments

Comments
 (0)