Skip to content

Commit 06e4045

Browse files
committed
docs: exhaustivestruct example explanation
Comment add context on `struct-patterns` patterns, so its not unexpected for users that patterns behaves in next way: 1. e.g. `*.Text` can match struct Test if golangci-lint launched against the file `golangcli-lint run example/example.go` 1. e.g. `*.Text` do not match struct Test if golangci-lint launched against package `golangcli-lint run example`
1 parent 625445b commit 06e4045

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.golangci.example.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,13 @@ linters-settings:
134134
default-signifies-exhaustive: false
135135

136136
exhaustivestruct:
137+
# Struct Patterns is list of expressions to match struct packages and names
138+
# The struct packages have the form example.com/package.ExampleStruct
139+
# The matching patterns can use matching syntax from https://pkg.go.dev/path#Match
140+
# If this list is empty, all structs are tested.
137141
struct-patterns:
138142
- '*.Test'
139-
- '*.Test2'
140-
- '*.Embedded'
141-
- '*.External'
143+
- 'example.com/package.ExampleStruct'
142144

143145
forbidigo:
144146
# Forbid the following identifiers

0 commit comments

Comments
 (0)