Skip to content

Commit 61f8c0e

Browse files
authored
build(deps): bump github.com/Antonboom/nilnil from 0.1.9 to 1.0.0 (#5058)
1 parent 9f4951f commit 61f8c0e

11 files changed

+252
-55
lines changed

.golangci.next.reference.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -2115,14 +2115,17 @@ linters-settings:
21152115
min-complexity: 4
21162116

21172117
nilnil:
2118+
# In addition, detect opposite situation (simultaneous return of non-nil error and valid value).
2119+
# Default: false
2120+
detect-opposite: true
21182121
# List of return types to check.
2119-
# Default: ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"]
2122+
# Default: ["chan", "func", "iface", "map", "ptr", "uintptr", "unsafeptr"]
21202123
checked-types:
2121-
- ptr
2124+
- chan
21222125
- func
21232126
- iface
21242127
- map
2125-
- chan
2128+
- ptr
21262129
- uintptr
21272130
- unsafeptr
21282131

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/4meepo/tagalign v1.3.4
99
github.com/Abirdcfly/dupword v0.1.1
1010
github.com/Antonboom/errname v1.0.0
11-
github.com/Antonboom/nilnil v0.1.9
11+
github.com/Antonboom/nilnil v1.0.0
1212
github.com/Antonboom/testifylint v1.5.0
1313
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c
1414
github.com/Crocmagnon/fatcontext v0.5.2

go.sum

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -2188,13 +2188,18 @@
21882188
"type": "object",
21892189
"additionalProperties": false,
21902190
"properties": {
2191+
"detect-opposite": {
2192+
"type": "boolean",
2193+
"description": "In addition, detect opposite situation (simultaneous return of non-nil error and valid value).",
2194+
"default": false
2195+
},
21912196
"checked-types": {
21922197
"type": "array",
21932198
"description": "List of return types to check.",
21942199
"items": {
2195-
"enum": ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"]
2200+
"enum": ["chan", "func", "iface", "map", "ptr", "uintptr", "unsafeptr"]
21962201
},
2197-
"default": ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"]
2202+
"default": ["chan", "func", "iface", "map", "ptr", "uintptr", "unsafeptr"]
21982203
}
21992204
}
22002205
},

pkg/config/linters_settings.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,8 @@ type NestifSettings struct {
733733
}
734734

735735
type NilNilSettings struct {
736-
CheckedTypes []string `mapstructure:"checked-types"`
736+
DetectOpposite bool `mapstructure:"detect-opposite"`
737+
CheckedTypes []string `mapstructure:"checked-types"`
737738
}
738739

739740
type NlreturnSettings struct {

pkg/golinters/nilnil/nilnil.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
package nilnil
22

33
import (
4-
"strings"
5-
64
"github.com/Antonboom/nilnil/pkg/analyzer"
75
"golang.org/x/tools/go/analysis"
86

97
"github.com/golangci/golangci-lint/pkg/config"
108
"github.com/golangci/golangci-lint/pkg/goanalysis"
119
)
1210

13-
func New(cfg *config.NilNilSettings) *goanalysis.Linter {
11+
func New(settings *config.NilNilSettings) *goanalysis.Linter {
1412
a := analyzer.New()
1513

1614
cfgMap := make(map[string]map[string]any)
17-
if cfg != nil && len(cfg.CheckedTypes) != 0 {
15+
if settings != nil {
1816
cfgMap[a.Name] = map[string]any{
19-
"checked-types": strings.Join(cfg.CheckedTypes, ","),
17+
"detect-opposite": settings.DetectOpposite,
18+
}
19+
if len(settings.CheckedTypes) != 0 {
20+
cfgMap[a.Name]["checked-types"] = settings.CheckedTypes
2021
}
2122
}
2223

0 commit comments

Comments
 (0)