Skip to content

Commit 3dafb43

Browse files
committed
docs: add godoc on Manager and the builders
1 parent 4647f2f commit 3dafb43

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

pkg/lint/lintersdb/builder_linter.go

+4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ import (
66
"github.com/golangci/golangci-lint/pkg/lint/linter"
77
)
88

9+
// LinterBuilder builds the "internal" linters based on the configuration.
910
type LinterBuilder struct{}
1011

12+
// NewLinterBuilder creates a new LinterBuilder.
1113
func NewLinterBuilder() *LinterBuilder {
1214
return &LinterBuilder{}
1315
}
1416

17+
// Build loads all the "internal" linters.
18+
// The configuration is use for the linter settings.
1519
func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
1620
if cfg == nil {
1721
return nil

pkg/lint/lintersdb/builder_plugin.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@ type AnalyzerPlugin interface {
1818
GetAnalyzers() []*analysis.Analyzer
1919
}
2020

21+
// PluginBuilder builds the custom linters (plugins) based on the configuration.
2122
type PluginBuilder struct {
2223
log logutils.Log
2324
}
2425

26+
// NewPluginBuilder creates new PluginBuilder.
2527
func NewPluginBuilder(log logutils.Log) *PluginBuilder {
2628
return &PluginBuilder{log: log}
2729
}
2830

29-
// Build loads private linters that are specified in the golangci-lint config file.
31+
// Build loads custom linters that are specified in the golangci-lint config file.
3032
func (b *PluginBuilder) Build(cfg *config.Config) []*linter.Config {
3133
if cfg == nil || b.log == nil {
3234
return nil

pkg/lint/lintersdb/manager.go

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ type Builder interface {
1919
Build(cfg *config.Config) []*linter.Config
2020
}
2121

22+
// Manager This a kind of database for all the linters (internals or plugins).
23+
// It provides methods to access to the linter sets.
2224
type Manager struct {
2325
log logutils.Log
2426
debugf logutils.DebugFunc
@@ -30,6 +32,8 @@ type Manager struct {
3032
nameToLCs map[string][]*linter.Config
3133
}
3234

35+
// NewManager creates a new Manager.
36+
// This constructor will call the builders to build and store the linters.
3337
func NewManager(log logutils.Log, cfg *config.Config, builders ...Builder) (*Manager, error) {
3438
m := &Manager{
3539
log: log,

0 commit comments

Comments
 (0)