Skip to content

Commit 7705f82

Browse files
committed
Update megacheck to the latest version
Also do following improvements: - show proper sublinter name for megacheck sublinters - refactor and make more simple and robust megacheck merging/optimizing - improve handling of unknown linter names in //nolint directives - minimize diff of our megacheck version from the upstream, golang/go#29612 blocks usage of the upstream version - support the new `stylecheck` linter - improve tests coverage for megacheck and nolint related cases - update and use upstream versions of unparam and interfacer instead of forked ones - don't use golangci/tools repo anymore - fix newly found issues after updating linters Also should be noted that megacheck works much faster and consumes less memory in the newest release, therefore golangci-lint works noticeably faster and consumes less memory for large repos. Relates: #314
1 parent 93b2d10 commit 7705f82

File tree

150 files changed

+17830
-1989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+17830
-1989
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ GolangCI-Lint can be used with zero configuration. By default the following lint
166166
```bash
167167
$ golangci-lint help linters
168168
Enabled by default linters:
169-
govet: Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true]
169+
govet (vet, vetshadow): Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true]
170170
errcheck: Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: true]
171171
staticcheck: Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false]
172172
unused: Checks Go code for unused constants, variables, functions and types [fast: false]
@@ -185,6 +185,7 @@ $ golangci-lint help linters
185185
...
186186
Disabled by default linters:
187187
golint: Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes [fast: true]
188+
stylecheck: Stylecheck is a replacement for golint [fast: false]
188189
gosec (gas): Inspects source code for security problems [fast: true]
189190
interfacer: Linter that suggests narrower interface types [fast: false]
190191
unconvert: Remove unnecessary type conversions [fast: true]
@@ -194,7 +195,6 @@ gocyclo: Computes and checks the cyclomatic complexity of functions [fast: true]
194195
gofmt: Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true]
195196
goimports: Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true]
196197
maligned: Tool to detect Go structs that would take less memory if their fields were sorted [fast: true]
197-
megacheck: 3 sub-linters in one: unused, gosimple and staticcheck [fast: false]
198198
depguard: Go linter that checks if package imports are in a list of acceptable packages [fast: true]
199199
misspell: Finds commonly misspelled English words in comments [fast: true]
200200
lll: Reports long lines [fast: true]
@@ -388,6 +388,7 @@ golangci-lint help linters
388388
### Disabled By Default Linters (`-E/--enable`)
389389
390390
- [golint](https://github.com/golang/lint) - Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
391+
- [stylecheck](https://github.com/dominikh/go-tools/tree/master/stylecheck) - Stylecheck is a replacement for golint
391392
- [gosec](https://github.com/securego/gosec) - Inspects source code for security problems
392393
- [interfacer](https://github.com/mvdan/interfacer) - Linter that suggests narrower interface types
393394
- [unconvert](https://github.com/mdempsky/unconvert) - Remove unnecessary type conversions
@@ -397,7 +398,6 @@ golangci-lint help linters
397398
- [gofmt](https://golang.org/cmd/gofmt/) - Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
398399
- [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports) - Goimports does everything that gofmt does. Additionally it checks unused imports
399400
- [maligned](https://github.com/mdempsky/maligned) - Tool to detect Go structs that would take less memory if their fields were sorted
400-
- [megacheck](https://github.com/dominikh/go-tools/tree/master/cmd/megacheck) - 3 sub-linters in one: unused, gosimple and staticcheck
401401
- [depguard](https://github.com/OpenPeeDeeP/depguard) - Go linter that checks if package imports are in a list of acceptable packages
402402
- [misspell](https://github.com/client9/misspell) - Finds commonly misspelled English words in comments
403403
- [lll](https://github.com/walle/lll) - Reports long lines
@@ -461,7 +461,7 @@ Flags:
461461
# govet: Common false positives
462462
- (possible misuse of unsafe.Pointer|should have signature)
463463
464-
# megacheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore
464+
# staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore
465465
- ineffective break statement. Did you mean to break out of the outer loop
466466
467467
# gosec: Too many false-positives on 'unsafe' usage

go.mod

+4-5
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,19 @@ require (
2121
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a
2222
github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6
2323
github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613
24-
github.com/golangci/go-tools v0.0.0-20180902103155-93eecd106a0b
24+
github.com/golangci/go-tools v0.0.0-20180109140146-be4842e24b95
2525
github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3
2626
github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee
2727
github.com/golangci/gofmt v0.0.0-20181105071733-0b8337e80d98
2828
github.com/golangci/gosec v0.0.0-20180901114220-8afd9cbb6cfb
2929
github.com/golangci/govet v0.0.0-20180818181408-44ddbe260190
3030
github.com/golangci/ineffassign v0.0.0-20180808204949-2ee8f2867dde
31-
github.com/golangci/interfacer v0.0.0-20180902080945-01958817a6ec
32-
github.com/golangci/lint v0.0.0-20180902080404-c2187e7932b5 // indirect
3331
github.com/golangci/lint-1 v0.0.0-20180610141402-4bf9709227d1
3432
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca
3533
github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770
3634
github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21
3735
github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0
38-
github.com/golangci/tools v0.0.0-20180902102414-2cefd77fef9b
3936
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4
40-
github.com/golangci/unparam v0.0.0-20180902112548-7ad9dbcccc16
4137
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce // indirect
4238
github.com/inconshreveable/mousetrap v1.0.0 // indirect
4339
github.com/magiconair/properties v1.7.6 // indirect
@@ -68,6 +64,9 @@ require (
6864
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
6965
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
7066
gopkg.in/yaml.v2 v2.2.1
67+
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed
68+
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
69+
mvdan.cc/unparam v0.0.0-20181201214637-68701730a1d7
7170
sourcegraph.com/sourcegraph/go-diff v0.0.0-20171119081133-3f415a150aec
7271
sourcegraph.com/sqs/pbtypes v0.0.0-20160107090929-4d1b9dc7ffc3 // indirect
7372
)

go.sum

+9-12
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6 h1:i2jIkQFb8RG45
4949
github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0=
5050
github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:WadunOE/TeHR8U7f0TXiJACHeU3cuFOXuKafw4rozqU=
5151
github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8=
52-
github.com/golangci/go-tools v0.0.0-20180902103155-93eecd106a0b h1:FSrt9JBK7JINu5UobyIF6epfpjL66H+67KZoTbE0zwk=
53-
github.com/golangci/go-tools v0.0.0-20180902103155-93eecd106a0b/go.mod h1:unzUULGw35sjyOYjUt0jMTXqHlZPpPc6e+xfO4cd6mM=
52+
github.com/golangci/go-tools v0.0.0-20180109140146-be4842e24b95 h1:msnLojqdJ37Bszm2D+srIkHJZvTKPFQWuyJAeMU6Ilo=
53+
github.com/golangci/go-tools v0.0.0-20180109140146-be4842e24b95/go.mod h1:unzUULGw35sjyOYjUt0jMTXqHlZPpPc6e+xfO4cd6mM=
5454
github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 h1:pe9JHs3cHHDQgOFXJJdYkK6fLz2PWyYtP4hthoCMvs8=
5555
github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3/go.mod h1:JXrF4TWy4tXYn62/9x8Wm/K/dm06p8tCKwFRDPZG/1o=
5656
github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee h1:J2XAy40+7yz70uaOiMbNnluTg7gyQhtGqLQncQh+4J8=
@@ -63,11 +63,6 @@ github.com/golangci/govet v0.0.0-20180818181408-44ddbe260190 h1:SLIgprnxQNjBpkz5
6363
github.com/golangci/govet v0.0.0-20180818181408-44ddbe260190/go.mod h1:pPwb+AK755h3/r73avHz5bEN6sa51/2HEZlLaV53hCo=
6464
github.com/golangci/ineffassign v0.0.0-20180808204949-2ee8f2867dde h1:qEGp3ZF1Qw6TkbWKn6GdJ12Ssu/CpJBaBcJ4hrUjrSo=
6565
github.com/golangci/ineffassign v0.0.0-20180808204949-2ee8f2867dde/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU=
66-
github.com/golangci/interfacer v0.0.0-20180902080945-01958817a6ec h1:rvg392QhtAd/yOevPRX4wzYMIDYyq99j9MV+Mb1uVHs=
67-
github.com/golangci/interfacer v0.0.0-20180902080945-01958817a6ec/go.mod h1:yBorupihJ5OYDFE7/EZwrslyNyZaaidqqVptYTcNxnk=
68-
github.com/golangci/lint v0.0.0-20170908181259-c2187e7932b5/go.mod h1:zs8jPuoOp76KrjiydDqO3CGeS4v9gq77HNNiYcxxTGw=
69-
github.com/golangci/lint v0.0.0-20180902080404-c2187e7932b5 h1:9NYm50bkzER4RayDaggNjxF5kesUJREASyFgk4AcIis=
70-
github.com/golangci/lint v0.0.0-20180902080404-c2187e7932b5/go.mod h1:zs8jPuoOp76KrjiydDqO3CGeS4v9gq77HNNiYcxxTGw=
7166
github.com/golangci/lint-1 v0.0.0-20180610141402-4bf9709227d1 h1:PHK2kIh21Zt4IcG0bBRzQwEDVKF64LnkoSXnm8lfJUk=
7267
github.com/golangci/lint-1 v0.0.0-20180610141402-4bf9709227d1/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y=
7368
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA=
@@ -78,12 +73,8 @@ github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 h1:leSNB7iYzLYSS
7873
github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI=
7974
github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 h1:HVfrLniijszjS1aiNg8JbBMO2+E1WIQ+j/gL4SQqGPg=
8075
github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4=
81-
github.com/golangci/tools v0.0.0-20180902102414-2cefd77fef9b h1:3hI7NZ9D3edEBVbN6V1urHWbFKJfcIlOFvX5m10jB88=
82-
github.com/golangci/tools v0.0.0-20180902102414-2cefd77fef9b/go.mod h1:zgj6NOYXOC1cexsdtDceI4/mj3aXK4JOVg9AV3C5LWI=
8376
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys=
8477
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ=
85-
github.com/golangci/unparam v0.0.0-20180902112548-7ad9dbcccc16 h1:QURX/XMP2uJUzzEvfJ291v1snmbJuyznAJLSQVnPyko=
86-
github.com/golangci/unparam v0.0.0-20180902112548-7ad9dbcccc16/go.mod h1:KW2L33j82vo0S0U6RP6uUQSuat+0Q457Yf+1mXC98/M=
8778
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
8879
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
8980
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce h1:xdsDDbiBDQTKASoGEZ+pEmF1OnWuu8AQ9I8iNbHNeno=
@@ -154,8 +145,8 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h
154145
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
155146
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
156147
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
157-
golang.org/x/tools v0.0.0-20180826000951-f6ba57429505/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
158148
golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
149+
golang.org/x/tools v0.0.0-20181201035826-d0ca3933b724/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
159150
golang.org/x/tools v0.0.0-20181220024903-92cdcd90bf52 h1:oOIe9Zzq27JsS/3ACpGF1HwWnWNflZWT/3EvM7mtcEk=
160151
golang.org/x/tools v0.0.0-20181220024903-92cdcd90bf52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
161152
gopkg.in/airbrake/gobrake.v2 v2.0.9 h1:7z2uVWwn7oVeeugY1DtlPAy5H+KYgB1KeKTnqjNatLo=
@@ -170,6 +161,12 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep
170161
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
171162
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
172163
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
164+
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I=
165+
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
166+
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo=
167+
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
168+
mvdan.cc/unparam v0.0.0-20181201214637-68701730a1d7 h1:AHc3hAmhXTHwSA40I4CJW2w2iirqwLzZuFgC6LdbtJk=
169+
mvdan.cc/unparam v0.0.0-20181201214637-68701730a1d7/go.mod h1:N4YHaPPCFjRU1vNrla2C9eoyqLxMaHmrsI8Th4iuQMY=
173170
sourcegraph.com/sourcegraph/go-diff v0.0.0-20171119081133-3f415a150aec h1:wAAdENPXC7bE1oxY4VqSDdhaA+XQ8TgQHsZMMnrXjEk=
174171
sourcegraph.com/sourcegraph/go-diff v0.0.0-20171119081133-3f415a150aec/go.mod h1:R09mWeb9JcPbO+A3cYDc11xjz0wp6r9+KnqdqROAoRU=
175172
sourcegraph.com/sqs/pbtypes v0.0.0-20160107090929-4d1b9dc7ffc3 h1:hXy8YsgVLDz5mlngKhNHQhAsAGrSp3dlXZN4b0/4UUI=

pkg/commands/config.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ func (e *Executor) initConfig() {
1717
Use: "config",
1818
Short: "Config",
1919
Run: func(cmd *cobra.Command, args []string) {
20+
if len(args) != 0 {
21+
e.log.Fatalf("Usage: golangci-lint config")
22+
}
2023
if err := cmd.Help(); err != nil {
2124
e.log.Fatalf("Can't run help: %s", err)
2225
}
@@ -34,7 +37,11 @@ func (e *Executor) initConfig() {
3437

3538
}
3639

37-
func (e *Executor) executePathCmd(cmd *cobra.Command, args []string) {
40+
func (e *Executor) executePathCmd(_ *cobra.Command, args []string) {
41+
if len(args) != 0 {
42+
e.log.Fatalf("Usage: golangci-lint config path")
43+
}
44+
3845
usedConfigFile := viper.ConfigFileUsed()
3946
if usedConfigFile == "" {
4047
e.log.Warnf("No config file detected")

pkg/commands/help.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ func (e *Executor) initHelp() {
1717
Use: "help",
1818
Short: "Help",
1919
Run: func(cmd *cobra.Command, args []string) {
20+
if len(args) != 0 {
21+
e.log.Fatalf("Usage: golangci-lint help")
22+
}
2023
if err := cmd.Help(); err != nil {
2124
e.log.Fatalf("Can't run help: %s", err)
2225
}
@@ -43,7 +46,7 @@ func printLinterConfigs(lcs []*linter.Config) {
4346
}
4447
}
4548

46-
func (e *Executor) executeLintersHelp(cmd *cobra.Command, args []string) {
49+
func (e *Executor) executeLintersHelp(_ *cobra.Command, args []string) {
4750
if len(args) != 0 {
4851
e.log.Fatalf("Usage: golangci-lint help linters")
4952
}

pkg/commands/linters.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func IsLinterInConfigsList(name string, linters []*linter.Config) bool {
3030
return false
3131
}
3232

33-
func (e *Executor) executeLinters(cmd *cobra.Command, args []string) {
33+
func (e *Executor) executeLinters(_ *cobra.Command, args []string) {
3434
if len(args) != 0 {
3535
e.log.Fatalf("Usage: golangci-lint linters")
3636
}

pkg/commands/root.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/golangci/golangci-lint/pkg/logutils"
1414
)
1515

16-
func (e *Executor) persistentPreRun(cmd *cobra.Command, args []string) {
16+
func (e *Executor) persistentPreRun(_ *cobra.Command, _ []string) {
1717
if e.cfg.Run.PrintVersion {
1818
fmt.Fprintf(logutils.StdOut, "golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date)
1919
os.Exit(0)
@@ -32,7 +32,7 @@ func (e *Executor) persistentPreRun(cmd *cobra.Command, args []string) {
3232
}
3333
}
3434

35-
func (e *Executor) persistentPostRun(cmd *cobra.Command, args []string) {
35+
func (e *Executor) persistentPostRun(_ *cobra.Command, _ []string) {
3636
if e.cfg.Run.CPUProfilePath != "" {
3737
pprof.StopCPUProfile()
3838
}
@@ -64,6 +64,9 @@ func (e *Executor) initRoot() {
6464
Short: "golangci-lint is a smart linters runner.",
6565
Long: `Smart, fast linters runner. Run it in cloud for every GitHub pull request on https://golangci.com`,
6666
Run: func(cmd *cobra.Command, args []string) {
67+
if len(args) != 0 {
68+
e.log.Fatalf("Usage: golangci-lint")
69+
}
6770
if err := cmd.Help(); err != nil {
6871
e.log.Fatalf("Can't run help: %s", err)
6972
}

pkg/commands/run.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ func (e *Executor) createPrinter() (printers.Printer, error) {
370370
return p, nil
371371
}
372372

373-
func (e *Executor) executeRun(cmd *cobra.Command, args []string) {
373+
func (e *Executor) executeRun(_ *cobra.Command, args []string) {
374374
needTrackResources := e.cfg.Run.IsVerbose || e.cfg.Run.PrintResourcesUsage
375375
trackResourcesEndCh := make(chan struct{})
376376
defer func() { // XXX: this defer must be before ctx.cancel defer

pkg/config/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var DefaultExcludePatterns = []ExcludePattern{
5555
},
5656
{
5757
Pattern: "ineffective break statement. Did you mean to break out of the outer loop",
58-
Linter: "megacheck",
58+
Linter: "staticcheck",
5959
Why: "Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore",
6060
},
6161
{
File renamed without changes.

pkg/golinters/interfacer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package golinters
33
import (
44
"context"
55

6-
"github.com/golangci/interfacer/check"
6+
"mvdan.cc/interfacer/check"
77

88
"github.com/golangci/golangci-lint/pkg/lint/linter"
99
"github.com/golangci/golangci-lint/pkg/result"

0 commit comments

Comments
 (0)