Skip to content

Commit 88750ef

Browse files
improove tag expression hashing
1 parent eeed90b commit 88750ef

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

tags3/expr.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ import (
1414
)
1515

1616
const (
17-
exprAnd rune = '&'
18-
exprOr rune = '|'
19-
exprNot string = "!"
20-
exprBracesOpen rune = '('
21-
exprBracesClose rune = ')'
22-
exprWildcard string = "*"
23-
exprWildcards string = "**"
17+
exprAnd rune = '&'
18+
exprOr rune = '|'
19+
exprNot string = "!"
20+
exprBracesOpen rune = '('
21+
exprBracesClose rune = ')'
22+
exprWildcard string = "*"
23+
exprWildcards string = "**"
24+
exprHashDelimiter rune = ';'
2425
)
2526

2627
type Expr interface {
@@ -124,12 +125,12 @@ func (e ValueExpr) hash() string {
124125
func (e AndExpr) hash() string {
125126
hashes := slicest.Map(e.Exprs, func(e Expr) string { return e.hash() })
126127
slices.Sort(hashes)
127-
return string(exprAnd) + strings.Join(hashes, ";")
128+
return string(exprAnd) + strings.Join(hashes, string(exprHashDelimiter))
128129
}
129130
func (e OrExpr) hash() string {
130131
hashes := slicest.Map(e.Exprs, func(e Expr) string { return e.hash() })
131132
slices.Sort(hashes)
132-
return string(exprOr) + strings.Join(hashes, ";")
133+
return string(exprOr) + strings.Join(hashes, string(exprHashDelimiter))
133134
}
134135
func (e NotExpr) hash() string {
135136
return exprNot + string(exprBracesOpen) + e.Expr.hash() + string(exprBracesClose)

0 commit comments

Comments
 (0)