Skip to content

Commit 7132502

Browse files
authored
Merge pull request #51 from vertti/add-recvcheck-nilnil-linters
Add recvcheck and nilnil linters
2 parents 64bdf0a + 2090376 commit 7132502

4 files changed

Lines changed: 6 additions & 3 deletions

File tree

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ linters:
2929
- exhaustive # check exhaustiveness of enum switch statements
3030
- intrange # use Go 1.22 range-over-integers
3131
- copyloopvar # detect issues with loop variable copying
32+
# Consistency
33+
- recvcheck # check receiver type consistency
34+
- nilnil # check for nil,nil returns (excluding intentional cases)
3235
settings:
3336
gocritic:
3437
enabled-tags:

pkg/check/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (r *Result) AddDetailf(format string, args ...any) *Result {
3333
// This provides a consistent pattern for optional regex compilation across check packages.
3434
func CompileRegex(pattern string) (*regexp.Regexp, error) {
3535
if pattern == "" {
36-
return nil, nil
36+
return nil, nil //nolint:nilnil // intentional: empty pattern means "no regex"
3737
}
3838
return regexp.Compile(pattern)
3939
}

pkg/check/result.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ type Result struct {
1717
}
1818

1919
// OK returns true if the check passed.
20-
func (r Result) OK() bool {
20+
func (r *Result) OK() bool {
2121
return r.Status == StatusOK
2222
}

pkg/version/parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func Parse(s string) (Version, error) {
4747
func ParseOptional(s string) (*Version, error) {
4848
s = strings.TrimSpace(s)
4949
if s == "" {
50-
return nil, nil
50+
return nil, nil //nolint:nilnil // intentional: empty string means "no version constraint"
5151
}
5252
v, err := Parse(s)
5353
if err != nil {

0 commit comments

Comments
 (0)