Skip to content

Commit a2141c9

Browse files
build(deps): bump github.com/gordonklaus/ineffassign from 0.1.0 to 0.2.0 (#6032)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 3641f1c commit a2141c9

File tree

8 files changed

+41
-8
lines changed

8 files changed

+41
-8
lines changed

.golangci.next.reference.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,6 +1873,11 @@ linters:
18731873
# Default: false
18741874
skip-single-param: true
18751875

1876+
ineffassign:
1877+
# Check escaping variables of type error, may cause false positives.
1878+
# Default: false
1879+
check-escaping-errors: true
1880+
18761881
interfacebloat:
18771882
# The maximum number of methods allowed for an interface.
18781883
# Default: 10

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ require (
5656
github.com/golangci/revgrep v0.8.0
5757
github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e
5858
github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e
59-
github.com/gordonklaus/ineffassign v0.1.0
59+
github.com/gordonklaus/ineffassign v0.2.0
6060
github.com/gostaticanalysis/forcetypeassert v0.2.0
6161
github.com/gostaticanalysis/nilerr v0.1.1
6262
github.com/hashicorp/go-version v1.7.0

go.sum

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,6 +2410,17 @@
24102410
}
24112411
}
24122412
},
2413+
"ineffassignSettings": {
2414+
"type": "object",
2415+
"additionalProperties": false,
2416+
"properties": {
2417+
"check-escaping-errors": {
2418+
"description": "Check escaping variables of type error, may cause false positives.",
2419+
"type": "boolean",
2420+
"default": false
2421+
}
2422+
}
2423+
},
24132424
"ireturnSettings": {
24142425
"type": "object",
24152426
"additionalProperties": false,
@@ -4567,6 +4578,9 @@
45674578
"inamedparam": {
45684579
"$ref": "#/definitions/settings/definitions/inamedparamSettings"
45694580
},
4581+
"ineffassign": {
4582+
"$ref": "#/definitions/settings/definitions/ineffassignSettings"
4583+
},
45704584
"ireturn": {
45714585
"$ref": "#/definitions/settings/definitions/ireturnSettings"
45724586
},

pkg/config/linters_settings.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ type LintersSettings struct {
254254
Iface IfaceSettings `mapstructure:"iface"`
255255
ImportAs ImportAsSettings `mapstructure:"importas"`
256256
Inamedparam INamedParamSettings `mapstructure:"inamedparam"`
257+
Ineffassign IneffassignSettings `mapstructure:"ineffassign"`
257258
InterfaceBloat InterfaceBloatSettings `mapstructure:"interfacebloat"`
258259
Ireturn IreturnSettings `mapstructure:"ireturn"`
259260
Lll LllSettings `mapstructure:"lll"`
@@ -644,6 +645,10 @@ type INamedParamSettings struct {
644645
SkipSingleParam bool `mapstructure:"skip-single-param"`
645646
}
646647

648+
type IneffassignSettings struct {
649+
CheckEscapingErrors bool `mapstructure:"check-escaping-errors"`
650+
}
651+
647652
type InterfaceBloatSettings struct {
648653
Max int `mapstructure:"max"`
649654
}

pkg/golinters/ineffassign/ineffassign.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@ package ineffassign
33
import (
44
"github.com/gordonklaus/ineffassign/pkg/ineffassign"
55

6+
"github.com/golangci/golangci-lint/v2/pkg/config"
67
"github.com/golangci/golangci-lint/v2/pkg/goanalysis"
78
)
89

9-
func New() *goanalysis.Linter {
10+
func New(settings *config.IneffassignSettings) *goanalysis.Linter {
11+
var cfg map[string]any
12+
13+
if settings != nil {
14+
cfg = map[string]any{
15+
"check-escaping-errors": settings.CheckEscapingErrors,
16+
}
17+
}
18+
1019
return goanalysis.
1120
NewLinterFromAnalyzer(ineffassign.Analyzer).
12-
WithDesc("Detects when assignments to existing variables are not used").
21+
WithConfig(cfg).
1322
WithLoadMode(goanalysis.LoadModeSyntax)
1423
}

pkg/lint/lintersdb/builder_linter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
424424
WithSince("v1.55.0").
425425
WithURL("https://github.com/macabu/inamedparam"),
426426

427-
linter.NewConfig(ineffassign.New()).
427+
linter.NewConfig(ineffassign.New(&cfg.Linters.Settings.Ineffassign)).
428428
WithGroups(config.GroupStandard).
429429
WithSince("v1.0.0").
430430
WithURL("https://github.com/gordonklaus/ineffassign"),

scripts/website/expand_templates/configuration.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"bytes"
55
"fmt"
6+
"log"
67
"os"
78
"path/filepath"
89
"reflect"
@@ -248,7 +249,7 @@ func (e *ExampleSnippetsExtractor) getSettingSections(node, nextNode *yaml.Node)
248249
settings, ok := allNodes[lc.Name]
249250
if !ok {
250251
if hasSettings(lc.Name) {
251-
return nil, fmt.Errorf("can't find %s settings in .golangci.reference.yml", lc.Name)
252+
log.Printf("can't find %s settings in .golangci.reference.yml", lc.Name)
252253
}
253254

254255
continue

0 commit comments

Comments
 (0)