You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,12 +40,23 @@ linters:
40
40
- example
41
41
```
42
42
4. Alternately, you can leave it disabled and turn it on via command line only:`golangci-lint run -Eexample`
43
+
5. If everything works correctly, you should see the linter show up as enabled by running`golangci-lint linters`. This linter will look for`// TODO:` in front of functions, so you can also add that to your code and see the errors.
44
+
6. You can also see the linter get loaded with the`-v` option for either`run` or`linters`
43
45
44
46
###To Configure Your Own`golang.org/x/tools/go/analysis` Based Linter
45
47
46
48
Your Linter must implement one or more`analysis.Analyzer` structs.
47
49
Your project should also use`go.mod`. All versions of libraries that overlap`golangci-lint` (including replaced libraries) MUST be set to the same version as`golangci-lint`. You can see the versions by running`go version -m golangci-lint`.
48
50
51
+
You'll also want to create a go file like`plugin/example.go`. This MUST be in the package`main`, and define:
52
+
1. A variable of type`analyzerPlugin`. The type`analyzerPlugin` can be defined as a string, struct, whatever.
53
+
```
54
+
type analyzerPlugin struct{}
55
+
var AnalyzerPlugin analyzerPlugin
56
+
```
57
+
2. A function with signature`func (*analyzerPlugin) GetLinterName() string`
58
+
3. A function with signature`func (*analyzerPlugin) GetLinterDesc() string`
59
+
4. A function with signature`func (*analyzerPlugin) GetAnalyzers() []*analysis.Analyzer`
49
60
50
61
\* Sorry, I haven't found a way to enable`go get` functionality for plugins yet. If you know how, let me know!