Skip to content

build(deps): bump github.com/4meepo/tagalign from 1.3.1 to 1.3.2 #3980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 28, 2023
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
1 change: 1 addition & 0 deletions .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,7 @@ linters-settings:
# Whether enable strict style.
# In this style, the tags will be sorted and aligned in the dictionary order,
# and the tags with the same name will be aligned together.
# Note: This option will be ignored if 'align' or 'sort' is false.
# Default: false
strict: true

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.19
require (
4d63.com/gocheckcompilerdirectives v1.2.1
4d63.com/gochecknoglobals v0.2.1
github.com/4meepo/tagalign v1.3.1
github.com/4meepo/tagalign v1.3.2
github.com/Abirdcfly/dupword v0.0.12
github.com/Antonboom/errname v0.1.10
github.com/Antonboom/nilnil v0.1.5
Expand Down
2 changes: 2 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/golinters/tagalign.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func NewTagAlign(settings *config.TagAlignSettings) *goanalysis.Linter {
options = append(options, tagalign.WithSort(settings.Order...))
}

if settings.Strict {
// Strict style will be applied only if Align and Sort are enabled together.
if settings.Strict && settings.Align && settings.Sort {
options = append(options, tagalign.WithStrictStyle())
}
}
Expand Down
5 changes: 5 additions & 0 deletions test/testdata/configs/tagalign_strict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
linters-settings:
tagalign:
align: true
sort: true
strict: true
10 changes: 10 additions & 0 deletions test/testdata/tagalign_strict.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//golangcitest:args -Etagalign
//golangcitest:config_path testdata/configs/tagalign_strict.yml
package testdata

import "time"

type TagAlignExampleStrictKO struct {
Foo time.Time `json:"foo,omitempty" validate:"required" zip:"foo"` // want ` json:"foo,omitempty" validate:"required" zip:"foo"`
FooBar struct{} `gorm:"column:fooBar" validate:"required" zip:"fooBar" xml:"fooBar" json:"fooBar,omitempty" yaml:"fooBar"` // want `gorm:"column:fooBar" json:"fooBar,omitempty" validate:"required" xml:"fooBar" yaml:"fooBar" zip:"fooBar"`
}