Skip to content

Commit 349a494

Browse files
committed
StrictStyle must be used with align and sort together.
1 parent aec487a commit 349a494

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

options.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ func WithAlign(enabled bool) Option {
2727
}
2828
}
2929

30-
// WithStyle specify the style of tagalign.
30+
// WithStrictStyle configure whether enable strict style.
31+
// StrictStyle is disabled by default.
32+
// Note: StrictStyle must be used with WithAlign(true) and WithSort(...) together, or it will be ignored.
3133
func WithStrictStyle() Option {
3234
return func(h *Helper) {
3335
h.style = StrictStyle

tagalign.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ func Run(pass *analysis.Pass, options ...Option) []Issue {
5252
opt(h)
5353
}
5454

55+
// StrictStyle must be used with WithAlign(true) and WithSort(...) together, or it will be ignored.
56+
if h.style == StrictStyle && (!h.align || !h.sort) {
57+
h.style = DefaultStyle
58+
}
59+
5560
if !h.align && !h.sort {
5661
// do nothing
5762
return nil

0 commit comments

Comments
 (0)