Skip to content

Commit d3cd0b0

Browse files
committed
docs: add comments
1 parent 74f0e0c commit d3cd0b0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/result/processors/formatter.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ import (
1717
"github.com/golangci/golangci-lint/pkg/result"
1818
)
1919

20+
// Formatter runs all the "formatters".
21+
// It should be run after the [Fixer] because:
22+
// - The code format is applied after the fixes to avoid changing positions.
23+
// - The [Fixer] writes the files on the disk (so the file cache cannot be used as it contains the files before fixes).
2024
type Formatter struct {
2125
log logutils.Log
2226
cfg *config.Config
2327
formatters []goformatters.Formatter
2428
}
2529

26-
func NewFormatter(log logutils.Log, cfg *config.Config,
27-
enabledLinters map[string]*linter.Config) (*Formatter, error) {
30+
// NewFormatter creates a new [Formatter].
31+
func NewFormatter(log logutils.Log, cfg *config.Config, enabledLinters map[string]*linter.Config) (*Formatter, error) {
2832
p := &Formatter{
2933
log: log,
3034
cfg: cfg,

0 commit comments

Comments
 (0)