-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable golangci-lint and go unit test github actions (#409)
* Enable golangci-lint github action Signed-off-by: Kimmo Lehto <[email protected]> Signed-off-by: Kimmo Lehto <[email protected]> * Automatic fixes via --fix Signed-off-by: Kimmo Lehto <[email protected]> * Manual lint fixes Signed-off-by: Kimmo Lehto <[email protected]> * Make unit tests pass Signed-off-by: Kimmo Lehto <[email protected]> * Manual fixes round 2 Signed-off-by: Kimmo Lehto <[email protected]> * Normalize logging syntax to "%s: .." instead of "%s .." Signed-off-by: Kimmo Lehto <[email protected]> * Restore the logo, exlude in linter Signed-off-by: Kimmo Lehto <[email protected]> * Remove "hostKind" argument from GetDockerInfo Signed-off-by: Kimmo Lehto <[email protected]> * Restore the RunHooks title test Signed-off-by: Kimmo Lehto <[email protected]> * Disable perfsprint Signed-off-by: Kimmo Lehto <[email protected]> * Fixed phase/manager logic for the phase success Signed-off-by: Dimitar Dimitrov <[email protected]> --------- Signed-off-by: Kimmo Lehto <[email protected]> Signed-off-by: Kimmo Lehto <[email protected]> Signed-off-by: Dimitar Dimitrov <[email protected]> Co-authored-by: Dimitar Dimitrov <[email protected]>
- Loading branch information
Showing
98 changed files
with
1,904 additions
and
1,117 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,34 @@ | ||
name: Go lint | ||
on: | ||
pull_request: | ||
paths: | ||
- '**.go' | ||
- 'go.mod' | ||
- 'go.sum' | ||
- '.golangci.yml' | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
if: github.ref != 'refs/heads/main' | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
check-latest: true | ||
|
||
- name: Check go.mod/go.sum to be consistent | ||
run: go mod tidy -v && git diff --exit-code | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
skip-cache: true | ||
only-new-issues: false | ||
args: --verbose |
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 |
---|---|---|
@@ -1,30 +1,88 @@ | ||
# Visit https://golangci-lint.run/ for usage documentation | ||
# and information on other useful linters | ||
issues: | ||
max-per-linter: 0 | ||
max-same-issues: 0 | ||
run: | ||
timeout: 8m | ||
|
||
skip-dirs-use-default: false | ||
skip-files: | ||
- ".*\\.gen\\.go" | ||
- examples/* | ||
- test/* | ||
- logo.go | ||
- logo_windows.go | ||
tests: false | ||
allow-parallel-runners: true | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
# enabled by default | ||
- errcheck | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- unused | ||
# additional | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- containedctx | ||
- contextcheck | ||
- dupword | ||
- durationcheck | ||
#- errcheck | ||
- errchkjson | ||
- errname | ||
- errorlint | ||
- execinquery | ||
- exportloopref | ||
#- forcetypeassert | ||
- forcetypeassert | ||
- gci | ||
- gocritic | ||
- godot | ||
- goerr113 | ||
- gofmt | ||
- gosimple | ||
- ineffassign | ||
- makezero | ||
- gofumpt | ||
- goimports | ||
- goprintffuncname | ||
- gosec | ||
- importas | ||
- ireturn | ||
- maintidx | ||
- mirror | ||
- misspell | ||
- nilerr | ||
- nakedret | ||
- nilnil | ||
- nolintlint | ||
- nosprintfhostport | ||
- prealloc | ||
- predeclared | ||
- staticcheck | ||
- reassign | ||
- revive | ||
- stylecheck | ||
- tenv | ||
- unconvert | ||
- unparam | ||
- unused | ||
- vet | ||
- usestdlibvars | ||
- varnamelen | ||
- wastedassign | ||
- whitespace | ||
- wrapcheck | ||
|
||
run: | ||
timeout: 10m | ||
linters-settings: | ||
varnamelen: | ||
max-distance: 10 | ||
ignore-decls: | ||
- w http.ResponseWriter | ||
- r *http.Request | ||
- i int | ||
- n int | ||
- p []byte | ||
- mu sync.Mutex | ||
- wg sync.WaitGroup | ||
- h Host | ||
- h os.Host | ||
- h *api.Host | ||
- ok bool | ||
- s string | ||
|
||
issues: | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 |
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
Oops, something went wrong.