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 d113be1
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 @@ -95,6 +96,7 @@ func (v retag) Visit(n ast.Node) ast.Visitor {
return nil
}

sort.Stable(newTags) // sort tags according to keys
for _, t := range newTags.Tags() {
oldTags.Set(t)
}
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 d113be1

Please sign in to comment.