fix golint issues in core/stringx (#516)
This commit is contained in:
@@ -5,8 +5,10 @@ import "github.com/tal-tech/go-zero/core/lang"
|
||||
const defaultMask = '*'
|
||||
|
||||
type (
|
||||
// TrieOption defines the method to customize a Trie.
|
||||
TrieOption func(trie *trieNode)
|
||||
|
||||
// A Trie is a tree implementation that used to find elements rapidly.
|
||||
Trie interface {
|
||||
Filter(text string) (string, []string, bool)
|
||||
FindKeywords(text string) []string
|
||||
@@ -23,6 +25,7 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
// NewTrie returns a Trie.
|
||||
func NewTrie(words []string, opts ...TrieOption) Trie {
|
||||
n := new(trieNode)
|
||||
|
||||
@@ -130,6 +133,7 @@ func (n *trieNode) replaceWithAsterisk(chars []rune, start, stop int) {
|
||||
}
|
||||
}
|
||||
|
||||
// WithMask customizes a Trie with keywords masked as given mask char.
|
||||
func WithMask(mask rune) TrieOption {
|
||||
return func(n *trieNode) {
|
||||
n.mask = mask
|
||||
|
||||
Reference in New Issue
Block a user