Skip to content

Commit fd8b030

Browse files
committed
Add gometalinter to CI
Signed-off-by: Daniel Nephin <[email protected]>
1 parent 639764c commit fd8b030

File tree

5 files changed

+37
-7
lines changed

5 files changed

+37
-7
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# github.com/docker/cli
33
#
44

5-
.PHONY: build clean cross
5+
.PHONY: build clean cross test lint
66

77
# build the CLI
88
build: clean
@@ -17,6 +17,9 @@ clean:
1717
test:
1818
@go test -tags daemon -v $(shell go list ./... | grep -v /vendor/)
1919

20+
lint:
21+
@gometalinter --config gometalinter.json ./...
22+
2023
# build the CLI for multiple architectures
2124
cross: clean
2225
@gox -output build/docker-{{.OS}}-{{.Arch}} \

circle.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,11 @@ jobs:
77
steps:
88
- checkout
99
- setup_remote_docker
10-
- run: docker build -f dockerfiles/Dockerfile.ci .
10+
- run:
11+
name: "Lint"
12+
command: |
13+
docker build -f dockerfiles/Dockerfile.lint --tag cli-linter .
14+
docker run cli-linter
15+
- run:
16+
name: "Build and Unit Test"
17+
command: docker build -f dockerfiles/Dockerfile.ci .

cli/command/container/exec_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ type arguments struct {
1313

1414
func TestParseExec(t *testing.T) {
1515
valids := map[*arguments]*types.ExecConfig{
16-
&arguments{
16+
{
1717
execCmd: []string{"command"},
1818
}: {
1919
Cmd: []string{"command"},
2020
AttachStdout: true,
2121
AttachStderr: true,
2222
},
23-
&arguments{
23+
{
2424
execCmd: []string{"command1", "command2"},
2525
}: {
2626
Cmd: []string{"command1", "command2"},
2727
AttachStdout: true,
2828
AttachStderr: true,
2929
},
30-
&arguments{
30+
{
3131
options: execOptions{
3232
interactive: true,
3333
tty: true,
@@ -42,7 +42,7 @@ func TestParseExec(t *testing.T) {
4242
Tty: true,
4343
Cmd: []string{"command"},
4444
},
45-
&arguments{
45+
{
4646
options: execOptions{
4747
detach: true,
4848
},
@@ -54,7 +54,7 @@ func TestParseExec(t *testing.T) {
5454
Detach: true,
5555
Cmd: []string{"command"},
5656
},
57-
&arguments{
57+
{
5858
options: execOptions{
5959
tty: true,
6060
interactive: true,

dockerfiles/Dockerfile.lint

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM golang:1.8-alpine
2+
3+
RUN apk add -U git
4+
5+
RUN go get -u gopkg.in/alecthomas/gometalinter.v1 && \
6+
mv /go/bin/gometalinter.v1 /usr/local/bin/gometalinter && \
7+
gometalinter --install
8+
9+
WORKDIR /go/src/github.com/docker/cli
10+
COPY . .
11+
ENTRYPOINT ["/usr/local/bin/gometalinter"]
12+
CMD ["--config=gometalinter.json", "./..."]

gometalinter.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Vendor": true,
3+
"Sort": ["linter", "severity"],
4+
"Exclude": ["cli/compose/schema/bindata.go"],
5+
6+
"DisableAll": true,
7+
"Enable": ["gofmt", "vet"]
8+
}

0 commit comments

Comments
 (0)