Skip to content

Commit

Permalink
build(deps): bump github.com/4meepo/tagalign from 1.3.1 to 1.3.2 (#3980)
Browse files Browse the repository at this point in the history
  • Loading branch information
4meepo committed Jul 28, 2023
1 parent ffe688c commit e555470
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 2 deletions.
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"`
}

0 comments on commit e555470

Please sign in to comment.