Skip to content

Commit 6bac409

Browse files
authored
fix: forbidigo migration (#5606)
1 parent 97f2fd6 commit 6bac409

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

pkg/commands/internal/migrate/migrate_linters_settings.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func toForbidigoSettings(old versionone.ForbidigoSettings) versiontwo.ForbidigoS
260260
}
261261

262262
for _, pattern := range old.Forbid {
263-
if pattern.Pattern == nil {
263+
if pattern.Pattern == nil && pattern.Msg == nil && pattern.Package == nil {
264264
buffer, err := pattern.MarshalString()
265265
if err != nil {
266266
// impossible case

pkg/commands/internal/migrate/testdata/yaml/linters-settings_forbidigo.golden.yml

+2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ linters:
1010
- pattern: ^spew\.(ConfigState\.)?Dump$
1111
- pattern: ^v1.Dump$
1212
pkg: ^example.com/pkg/api/v1$
13+
- pkg: ^github.com/howeyc/gopass$
14+
msg: github.com/howeyc/gopass is archived, use golang.org/x/term instead
1315
exclude-godoc-examples: false
1416
analyze-types: true

pkg/commands/internal/migrate/testdata/yaml/linters-settings_forbidigo.yml

+2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ linters-settings:
1616
- ^spew\.(ConfigState\.)?Dump$
1717
- p: ^v1.Dump$
1818
pkg: ^example.com/pkg/api/v1$
19+
- pkg: ^github.com/howeyc/gopass$
20+
msg: "github.com/howeyc/gopass is archived, use golang.org/x/term instead"
1921
exclude-godoc-examples: false
2022
analyze-types: true

0 commit comments

Comments
 (0)