-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[linting] Add golangci-lint and GHA that runs it (#36)
## Summary * Moves tests over to own workflow. Release jobs depend on it. * Adds golangci linter and runs it in test workflows. * Adds new pull request template. ## How was it tested? GHA
- Loading branch information
1 parent
be97495
commit 14c47ea
Showing
9 changed files
with
115 additions
and
25 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,3 @@ | ||
## Summary | ||
|
||
## How was it tested? |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: tests | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
workflow_call: | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read | ||
|
||
jobs: | ||
golangci-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: ./go.mod | ||
cache: false # use golangci cache instead | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3.2.0 | ||
with: | ||
args: --timeout=10m | ||
|
||
golang-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: ./go.mod | ||
cache: true | ||
- name: Build the module | ||
run: go build -v ./... | ||
- name: Run all tests | ||
run: go test -v ./... |
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,53 @@ | ||
run: | ||
go: "1.19" | ||
linters: | ||
disable-all: true | ||
enable: | ||
- dupl | ||
- errorlint | ||
- errcheck | ||
- gofmt | ||
- goimports | ||
- gosimple | ||
- govet | ||
- importas | ||
- ineffassign | ||
- misspell | ||
- nilerr | ||
- reassign | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- usestdlibvars | ||
- varnamelen | ||
# - wrapcheck If we're going to use github.com/pkg/errors we should probably turn this on? | ||
|
||
# We'd like to have the following linter enabled, but it's broken for Go | ||
# 1.19 as of golangci-lint v1.48.0. Re-enable it when this issue is | ||
# fixed: https://github.com/golangci/golangci-lint/issues/2649 | ||
# - structcheck | ||
issues: | ||
exclude: | ||
|
||
linters-settings: | ||
varnamelen: | ||
max-distance: 10 | ||
ignore-decls: | ||
- T any | ||
- c echo.Context | ||
- const C | ||
- e error | ||
- e watch.Event | ||
- f *foo.Bar | ||
- i int | ||
- id string | ||
- m map[string]any | ||
- m map[string]int | ||
- ns string | ||
- r *http.Request | ||
- t testing.T | ||
- w http.ResponseWriter | ||
- w io.Writer |
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
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
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