Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0241915

Browse files
authored
Update README.md
1 parent2bc1f52 commit0241915

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎README.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,23 @@ linters:
4040
- example
4141
```
4242
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`
4345

4446
###To Configure Your Own`golang.org/x/tools/go/analysis` Based Linter
4547

4648
Your Linter must implement one or more`analysis.Analyzer` structs.
4749
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`.
4850

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`
4960

5061
\* Sorry, I haven't found a way to enable`go get` functionality for plugins yet. If you know how, let me know!
5162

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp