-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Use golangci-lint for linting (#108)
Instead of hand-managing and running linters, use golangci-lint. This simplifies the Makefile and allows lint to run in parallel with the build/test job. Along with the golangci-lint defaults, enable a couple other linters we generally agree with. See also uber-go/zap#1323 and uber-go/sally#121 for similar changes.
- Loading branch information
Showing
8 changed files
with
110 additions
and
179 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,55 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
tags: ['v*'] | ||
pull_request: | ||
branches: ['*'] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go: ["1.20.x", "1.21.x"] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
- name: Test | ||
run: make cover | ||
|
||
- name: Upload coverage to codecov.io | ||
uses: codecov/codecov-action@v3 | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Check out repository | ||
- uses: actions/setup-go@v4 | ||
name: Set up Go | ||
with: | ||
go-version: 1.21.x | ||
cache: false # managed by golangci-lint | ||
|
||
- uses: golangci/golangci-lint-action@v3 | ||
name: Install golangci-lint | ||
with: | ||
version: latest | ||
args: --version # make lint will run the linter | ||
|
||
- run: make lint | ||
name: Lint |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
output: | ||
# Make output more digestible with quickfix in vim/emacs/etc. | ||
sort-results: true | ||
print-issued-lines: false | ||
|
||
linters: | ||
enable: | ||
- gofumpt | ||
- nolintlint | ||
- revive | ||
|
||
linters-settings: | ||
govet: | ||
# These govet checks are disabled by default, but they're useful. | ||
enable: | ||
- niliness | ||
- reflectvaluecompare | ||
- sortslice | ||
- unusedwrite | ||
|
||
issues: | ||
# Print all issues reported by all linters. | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 | ||
|
||
# Don't ignore some of the issues that golangci-lint considers okay. | ||
# This includes documenting all exported entities. | ||
exclude-use-default: false |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.