Skip to content

Commit

Permalink
lint(nilaway): Added nilaway configs to linter
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Kosiewski <[email protected]>
  • Loading branch information
Thomas Kosiewski committed Jul 10, 2024
1 parent 0f5ed7d commit b7562e1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .custom-gcl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This has to be >= v1.57.0 for module plugin system support.
version: v1.59.1
plugins:
- module: "go.uber.org/nilaway"
import: "go.uber.org/nilaway/cmd/gclplugin"
version: latest # Or a fixed version for reproducible builds.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ profile.out
*.test
tests/__snapshot__
/licenses
custom-gcl
12 changes: 11 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ linters:
disable-all: true
enable:
- asasalint
- tagalign
- asciicheck
- bidichk
- decorder
Expand All @@ -28,10 +27,12 @@ linters:
- makezero
- misspell
- nakedret
- nilaway
- promlinter
- revive
- staticcheck
- stylecheck
- tagalign
- typecheck
- unconvert
- unused
Expand Down Expand Up @@ -86,6 +87,15 @@ linters-settings:
- xml
- form

custom:
nilaway:
type: "module"
description: Static analysis tool to detect potential nil panics in Go code.
settings:
# Settings must be a "map from string to string" to mimic command line flags: the keys are
# flag names and the values are the values to the particular flags.
include-pkgs: "github.com/loft-sh/vcluster"

issues:
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
Expand Down
3 changes: 3 additions & 0 deletions .ignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
!/.github/
/vendor/
!.golangci.yml
!.goreleaser.yaml
!.custom-gcl.yml
3 changes: 2 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ release-snapshot: gen-license-report

# Run golangci-lint for all packages
lint *ARGS:
golangci-lint run {{ARGS}}
[ -f ./custom-gcl ] || golangci-lint custom
./custom-gcl run {{ARGS}}

# Check struct memory alignment and print potential improvements
[no-exit-message]
Expand Down

0 comments on commit b7562e1

Please sign in to comment.