Skip to content

Commit

Permalink
sort tags in consistent order
Browse files Browse the repository at this point in the history
  • Loading branch information
ucpr committed Aug 4, 2024
1 parent 1b215e0 commit 0cfffd0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions module/replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package module
import (
"go/ast"
"go/token"
"sort"
"strings"

"github.com/fatih/structtag"
Expand Down Expand Up @@ -98,6 +99,7 @@ func (v retag) Visit(n ast.Node) ast.Visitor {
for _, t := range newTags.Tags() {
oldTags.Set(t)
}
sort.Stable(oldTags)

f.Tag.Value = "`" + oldTags.String() + "`"

Expand Down
1 change: 0 additions & 1 deletion module/tagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ func (mod) Name() string {
}

func (m mod) Execute(targets map[string]pgs.File, packages map[string]pgs.Package) []pgs.Artifact {

xtv := m.Parameters().Str("xxx")

xtv = strings.Replace(xtv, "+", ":", -1)
Expand Down

0 comments on commit 0cfffd0

Please sign in to comment.