Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ func (l *Loader) handleFormatterOverrides() {
if slices.Contains(l.cfg.Formatters.Enable, "gci") {
l.cfg.Linters.Settings.Gci = l.cfg.Formatters.Settings.Gci
}

if slices.Contains(l.cfg.Formatters.Enable, "golines") {
l.cfg.Linters.Settings.GoLines = l.cfg.Formatters.Settings.GoLines
}
}

// Add formatter exclusions to linters exclusions.
Expand Down
16 changes: 16 additions & 0 deletions pkg/golinters/golines/testdata/fix/in/golines-custom.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//golangcitest:config_path testdata/golines-custom.yml
//golangcitest:expected_exitcode 0
package testdata

// the struct tags should not be reformatted here
type Foo struct {
Bar `a:"b=\"c\"" d:"e"`
Baz `a:"f" d:"g"`
}

var (
// this ends at 80 columns with tab size 2, and would only be a little wider
// with tab size 8, not failing the default line-len, so it checks both
// settings are applied properly
abc = []string{"a string that is only wrapped at narrow widths and wide tabs"}
)
18 changes: 18 additions & 0 deletions pkg/golinters/golines/testdata/fix/out/golines-custom.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//golangcitest:config_path testdata/golines-custom.yml
//golangcitest:expected_exitcode 0
package testdata

// the struct tags should not be reformatted here
type Foo struct {
Bar `a:"b=\"c\"" d:"e"`
Baz `a:"f" d:"g"`
}

var (
// this ends at 80 columns with tab size 2, and would only be a little wider
// with tab size 8, not failing the default line-len, so it checks both
// settings are applied properly
abc = []string{
"a string that is only wrapped at narrow widths and wide tabs",
}
)
11 changes: 11 additions & 0 deletions pkg/golinters/golines/testdata/golines-custom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "2"

formatters:
enable:
- golines
settings:
golines:
# override many settings
max-len: 80
tab-len: 8
reformat-tags: false
Loading