Skip to content

build(deps): bump github.com/Antonboom/nilnil from 0.1.9 to 1.0.0 #5058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2115,14 +2115,17 @@ linters-settings:
min-complexity: 4

nilnil:
# In addition, detect opposite situation (simultaneous return of non-nil error and valid value).
# Default: false
detect-opposite: true
# List of return types to check.
# Default: ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"]
# Default: ["chan", "func", "iface", "map", "ptr", "uintptr", "unsafeptr"]
checked-types:
- ptr
- chan
- func
- iface
- map
- chan
- ptr
- uintptr
- unsafeptr

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/4meepo/tagalign v1.3.4
github.com/Abirdcfly/dupword v0.1.1
github.com/Antonboom/errname v1.0.0
github.com/Antonboom/nilnil v0.1.9
github.com/Antonboom/nilnil v1.0.0
github.com/Antonboom/testifylint v1.5.0
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c
github.com/Crocmagnon/fatcontext v0.5.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2188,13 +2188,18 @@
"type": "object",
"additionalProperties": false,
"properties": {
"detect-opposite": {
"type": "boolean",
"description": "In addition, detect opposite situation (simultaneous return of non-nil error and valid value).",
"default": false
},
"checked-types": {
"type": "array",
"description": "List of return types to check.",
"items": {
"enum": ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"]
"enum": ["chan", "func", "iface", "map", "ptr", "uintptr", "unsafeptr"]
},
"default": ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"]
"default": ["chan", "func", "iface", "map", "ptr", "uintptr", "unsafeptr"]
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,8 @@ type NestifSettings struct {
}

type NilNilSettings struct {
CheckedTypes []string `mapstructure:"checked-types"`
DetectOpposite bool `mapstructure:"detect-opposite"`
CheckedTypes []string `mapstructure:"checked-types"`
}

type NlreturnSettings struct {
Expand Down
11 changes: 6 additions & 5 deletions pkg/golinters/nilnil/nilnil.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package nilnil

import (
"strings"

"github.com/Antonboom/nilnil/pkg/analyzer"
"golang.org/x/tools/go/analysis"

"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/goanalysis"
)

func New(cfg *config.NilNilSettings) *goanalysis.Linter {
func New(settings *config.NilNilSettings) *goanalysis.Linter {
a := analyzer.New()

cfgMap := make(map[string]map[string]any)
if cfg != nil && len(cfg.CheckedTypes) != 0 {
if settings != nil {
cfgMap[a.Name] = map[string]any{
"checked-types": strings.Join(cfg.CheckedTypes, ","),
"detect-opposite": settings.DetectOpposite,
}
if len(settings.CheckedTypes) != 0 {
cfgMap[a.Name]["checked-types"] = settings.CheckedTypes
}
}

Expand Down
Loading
Loading