Skip to content

Commit cd1b272

Browse files
fix: add test case for golines settings
1 parent 3caa14d commit cd1b272

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//golangcitest:config_path testdata/golines-custom.yml
2+
//golangcitest:expected_exitcode 0
3+
package testdata
4+
5+
// the struct tags should not be reformatted here
6+
type Foo struct {
7+
Bar `a:"b=\"c\"" d:"e"`
8+
Baz `a:"f" d:"g"`
9+
}
10+
11+
var (
12+
// this ends at 80 columns with tab size 2, and would only be a little wider
13+
// with tab size 8, not failing the default line-len, so it checks both
14+
// settings are applied properly
15+
abc = []string{"a string that is only wrapped at narrow widths and wide tabs"}
16+
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//golangcitest:config_path testdata/golines-custom.yml
2+
//golangcitest:expected_exitcode 0
3+
package testdata
4+
5+
// the struct tags should not be reformatted here
6+
type Foo struct {
7+
Bar `a:"b=\"c\"" d:"e"`
8+
Baz `a:"f" d:"g"`
9+
}
10+
11+
var (
12+
// this ends at 80 columns with tab size 2, and would only be a little wider
13+
// with tab size 8, not failing the default line-len, so it checks both
14+
// settings are applied properly
15+
abc = []string{
16+
"a string that is only wrapped at narrow widths and wide tabs",
17+
}
18+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "2"
2+
3+
formatters:
4+
enable:
5+
- golines
6+
settings:
7+
golines:
8+
# override many settings
9+
max-len: 80
10+
tab-len: 8
11+
reformat-tags: false

0 commit comments

Comments
 (0)