This repository has been archived by the owner on Jun 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Switch from gometalinter to golangci-lint
The former is deprecated in favour of the later, which is faster and less memory hungry. The `.golangci.yml` is a straight translation of the enabled linters and exclusions from `gometalinter.json`, except: - The exclusions of `specification/bindata.go` and `templateloader` no longer seem relevant (nothing hits, the latter no longer exists) so those are dropped. - I didn't copy over the various tweaks to output formats (the `sort` key) nor the deadline setting. - There is currently no equivalent to the `WarnUnmatchedDirective` key, see golangci/golangci-lint#404 - The `unparam` linter now catches a few things which it didn't before, these are fixed here: pkg/yatee/yatee.go:131:39: tokenize - result 1 (error) is always nil (unparam) func tokenize(expr string) ([]string, error) { ^ pkg/yatee/yatee_test.go:31:47: `testProcess` - `parameters` always receives `parameters` (`"\nfoo: bar\nloop: $loop\napp:\n mode: debug\n release: false\n co...`) (unparam) func testProcess(t *testing.T, input, output, parameters, error string) { ^ pkg/yatee/yatee_test.go:147:56: `testProcessWithOrder` - `error` is unused (unparam) func testProcessWithOrder(t *testing.T, input, output, error string) { ^ The first and third by dropping the unused return value and parameter respectively. For the middle one I marked as `nolint` since it makes sense to keep `parameters` defined in the caller since they are combined with `input` to produce `output` and it is useful to have them in the same context. The `nakedret` linter is part of `golangci-lint` already so there is no need to add it separately. Signed-off-by: Ian Campbell <[email protected]>
- Loading branch information
Ian Campbell
committed
Apr 5, 2019
1 parent
376c15d
commit 83e60a2
Showing
6 changed files
with
37 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
linters: | ||
enable-all: false | ||
disable-all: true | ||
enable: | ||
- deadcode | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- golint | ||
- gosimple | ||
- ineffassign | ||
- interfacer | ||
- lll | ||
- misspell | ||
- nakedret | ||
- unconvert | ||
- unparam | ||
- unused | ||
- vet | ||
linters-settings: | ||
gocyclo: | ||
min-complexity: 16 | ||
lll: | ||
line-length: 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,18 +8,8 @@ RUN apk add --no-cache \ | |
make \ | ||
coreutils | ||
|
||
ENV GOMETALITER_VERSION=2.0.11 | ||
ENV NAKEDRECT_SHA=c0e305a4f690fed163d47628bcc06a6d5655bf92 | ||
|
||
WORKDIR /go/src/github.com/alecthomas/gometalinter | ||
RUN curl -L https://github.com/alecthomas/gometalinter/archive/v${GOMETALITER_VERSION}.tar.gz | tar xz --strip-components=1 \ | ||
&& go build -v -o /usr/local/bin/gometalinter . \ | ||
&& gometalinter --install \ | ||
&& rm -rf /go/src/* /go/pkg/* | ||
|
||
WORKDIR /go/src/github.com/alexkohler/nakedret | ||
RUN git clone https://github.com/alexkohler/nakedret.git /go/src/github.com/alexkohler/nakedret \ | ||
&& go build -v -o /usr/local/bin/nakedret . \ | ||
RUN GO111MODULE=on go get \ | ||
github.com/golangci/golangci-lint/cmd/[email protected] \ | ||
&& rm -rf /go/src/* /go/pkg/* | ||
|
||
WORKDIR /go/src/github.com/docker/app | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters