forked from golangci/golangci-lint
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(deps): bump github.com/maratori/testpackage from 1.0.1 to 1.1.0 (…
…golangci#2945) Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
61 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package golinters | ||
|
||
import ( | ||
"github.com/sivchari/nosnakecase" | ||
"golang.org/x/tools/go/analysis" | ||
|
||
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis" | ||
) | ||
|
||
func NewNoSnakeCase() *goanalysis.Linter { | ||
a := nosnakecase.Analyzer | ||
|
||
return goanalysis.NewLinter( | ||
a.Name, | ||
a.Doc, | ||
[]*analysis.Analyzer{a}, | ||
nil, | ||
).WithLoadMode(goanalysis.LoadModeSyntax) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// args: -Enosnakecase | ||
package testdata | ||
|
||
func a_() { // ERROR "a_ is used under score. You should use mixedCap or MixedCap." | ||
} | ||
|
||
func b(a_a int) { // ERROR "a_a is used under score. You should use mixedCap or MixedCap." | ||
} | ||
|
||
func c() (c_c int) { // ERROR "c_c is used under score. You should use mixedCap or MixedCap." | ||
c_c = 1 // ERROR "c_c is used under score. You should use mixedCap or MixedCap." | ||
return c_c // It's never detected, because `c_c` is already detected. | ||
} | ||
|
||
func d() { | ||
var d_d int // ERROR "d_d is used under score. You should use mixedCap or MixedCap." | ||
_ = d_d // It's never detected, because `_` is meaningful in Go and `d_d` is already detected. | ||
} |