
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, https://github.com/golang/go/issues/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
26 lines
550 B
Go
26 lines
550 B
Go
//args: -Egosimple
|
|
package testdata
|
|
|
|
import "strings"
|
|
|
|
func Gosimple(id1, s1 string) string {
|
|
if strings.HasPrefix(id1, s1) { // ERROR "should replace.*with.*strings.TrimPrefix"
|
|
id1 = strings.TrimPrefix(id1, s1)
|
|
}
|
|
return id1
|
|
}
|
|
|
|
func GosimpleNolintGosimple(id1, s1 string) string {
|
|
if strings.HasPrefix(id1, s1) { //nolint:gosimple
|
|
id1 = strings.TrimPrefix(id1, s1)
|
|
}
|
|
return id1
|
|
}
|
|
|
|
func GosimpleNolintMegacheck(id1, s1 string) string {
|
|
if strings.HasPrefix(id1, s1) { //nolint:megacheck
|
|
id1 = strings.TrimPrefix(id1, s1)
|
|
}
|
|
return id1
|
|
}
|