github.com/google/osv-scalibr@v0.4.1/linter/plugger/README.md (about) 1 # Plugger 2 3 Searches for not registered plugins: a plugin is a struct that implements a 4 given interface. 5 6 ## Usage 7 8 ```sh 9 ~ plugger -h 10 Usage of plugger: 11 -interface value 12 list of interfaces (repeatable), ex: '-interface github.com/pkg.Interface' 13 ``` 14 15 ### No lint rules 16 17 exclude a function 18 19 ```go 20 // This function is called 21 func NewPlugin() basic.MyPlugin { 22 return &basic.PluginA{} 23 } 24 25 // This is treated as alias automatically 26 func NewPluginAlias(something string) basic.MyPlugin { 27 return &basic.PluginA{} 28 } 29 30 // NewForTest: since this function is intended to be used in tests only, 31 // must be excluded from the lint 32 // 33 //nolint:plugger // This function is meant to be used only in testing and returns the same plugin as fun.NewPlugin 34 func NewForTest(something string) basic.MyPlugin { 35 return &basic.PluginA{} 36 } 37 ``` 38 39 or directly exclude a pkg 40 41 ```go 42 // Package fakeplugin contains a fake plugin to be used in testing 43 // 44 //nolint:plugger // This pkg contains only mocks 45 package fakeplugin 46 ```