mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
convert uses of interface{} to any
Done via:
find . -name "*.go" | xargs sed -i -E 's/interface\{\}/any/g'
PiperOrigin-RevId: 487033228
This commit is contained in:
committed by
gVisor bot
parent
c82b70015d
commit
d8aa09e04c
+4
-4
@@ -18,7 +18,7 @@ package trie
|
||||
|
||||
// Visitor accepts a prefix string and an associated value, and returns true iff searching should
|
||||
// continue deeper into the Trie. It is used by FindMatching().
|
||||
type Visitor func(prefix string, value interface{}) bool
|
||||
type Visitor func(prefix string, value any) bool
|
||||
|
||||
// Trie stores data at given strings in tree structure, for linear-time retrieval.
|
||||
// Call New() to obtain a valid Trie.
|
||||
@@ -33,7 +33,7 @@ func New() *Trie {
|
||||
}
|
||||
|
||||
type node struct {
|
||||
value interface{}
|
||||
value any
|
||||
children map[rune]*node
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ func (t *Trie) FindPrefixes(key string, f Visitor) {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Trie) updateNode(n *node, newValue interface{}) {
|
||||
func (t *Trie) updateNode(n *node, newValue any) {
|
||||
if n.value != nil {
|
||||
t.size--
|
||||
}
|
||||
@@ -70,7 +70,7 @@ func (t *Trie) updateNode(n *node, newValue interface{}) {
|
||||
}
|
||||
|
||||
// SetValue associates the specified key with the given value, replacing any existing value.
|
||||
func (t *Trie) SetValue(key string, value interface{}) {
|
||||
func (t *Trie) SetValue(key string, value any) {
|
||||
cur := t.root
|
||||
for _, r := range key {
|
||||
next, ok := cur.children[r]
|
||||
|
||||
@@ -28,7 +28,7 @@ type Entry struct {
|
||||
|
||||
func collectPrefixes(tr *Trie, key string) []Entry {
|
||||
arr := make([]Entry, 0)
|
||||
tr.FindPrefixes(key, func(p string, v interface{}) bool {
|
||||
tr.FindPrefixes(key, func(p string, v any) bool {
|
||||
arr = append(arr, Entry{Key: p, Value: v.(string)})
|
||||
return true
|
||||
})
|
||||
@@ -37,7 +37,7 @@ func collectPrefixes(tr *Trie, key string) []Entry {
|
||||
|
||||
func collectSuffixes(tr *Trie, key string) []Entry {
|
||||
arr := make([]Entry, 0)
|
||||
tr.FindSuffixes(key, func(p string, v interface{}) bool {
|
||||
tr.FindSuffixes(key, func(p string, v any) bool {
|
||||
arr = append(arr, Entry{Key: p, Value: v.(string)})
|
||||
return true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user