mirror of
https://github.com/spf13/cobra
synced 2025-05-06 13:27:26 +00:00
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.
This commit is contained in:
parent
144d7bc199
commit
6671edee26
3 changed files with 49 additions and 33 deletions
|
@ -1,15 +1,11 @@
|
||||||
workflows:
|
|
||||||
version: 2
|
version: 2
|
||||||
main:
|
|
||||||
jobs:
|
references:
|
||||||
- go-current
|
workspace: &workspace
|
||||||
- go-previous
|
/go/src/github.com/spf13/cobra
|
||||||
- go-latest
|
|
||||||
base: &base
|
run_tests: &run_tests
|
||||||
working_directory: /go/src/github.com/spf13/cobra
|
run:
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run:
|
|
||||||
name: "All Commands"
|
name: "All Commands"
|
||||||
command: |
|
command: |
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
|
@ -18,21 +14,40 @@ base: &base
|
||||||
go get -t -v ./...
|
go get -t -v ./...
|
||||||
PATH=$PATH:$PWD/bin go test -v ./...
|
PATH=$PATH:$PWD/bin go test -v ./...
|
||||||
go build
|
go build
|
||||||
diff -u <(echo -n) <(gofmt -d -s .)
|
|
||||||
if [ -z $NOVET ]; then
|
if [ -z $NOVET ]; then
|
||||||
diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
|
diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
|
||||||
fi
|
fi
|
||||||
version: 2
|
|
||||||
jobs:
|
jobs:
|
||||||
go-current:
|
go-current:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/golang:1.11
|
- image: circleci/golang:1.11
|
||||||
<<: *base
|
working_directory: *workspace
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *run_tests
|
||||||
|
- run:
|
||||||
|
name: "Check formatting"
|
||||||
|
command: diff -u <(echo -n) <(gofmt -d -s .)
|
||||||
go-previous:
|
go-previous:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/golang:1.10
|
- image: circleci/golang:1.10
|
||||||
<<: *base
|
working_directory: *workspace
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *run_tests
|
||||||
go-latest:
|
go-latest:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/golang:latest
|
- image: circleci/golang:latest
|
||||||
<<: *base
|
working_directory: *workspace
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *run_tests
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
main:
|
||||||
|
jobs:
|
||||||
|
- go-current
|
||||||
|
- go-previous
|
||||||
|
- go-latest
|
||||||
|
|
|
@ -5,6 +5,8 @@ matrix:
|
||||||
- go: 1.10.x
|
- go: 1.10.x
|
||||||
- go: 1.11.x
|
- go: 1.11.x
|
||||||
- go: tip
|
- go: tip
|
||||||
|
- go: 1.11.x
|
||||||
|
script: diff -u <(echo -n) <(gofmt -d -s .)
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- go: tip
|
- go: tip
|
||||||
|
|
||||||
|
@ -15,7 +17,6 @@ before_install:
|
||||||
script:
|
script:
|
||||||
- PATH=$PATH:$PWD/bin go test -v ./...
|
- PATH=$PATH:$PWD/bin go test -v ./...
|
||||||
- go build
|
- go build
|
||||||
- diff -u <(echo -n) <(gofmt -d -s .)
|
|
||||||
- if [ -z $NOVET ]; then
|
- if [ -z $NOVET ]; then
|
||||||
diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
|
diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue