1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package tui
import (
"fmt"
"reflect"
)
type mountKeyNode struct {
parent any
part any
}
func MountKey(site int, parts ...any) any {
var key any = site
for _, part := range parts {
if part != nil && !reflect.TypeOf(part).Comparable() {
panic(fmt.Sprintf("tui.MountKey: key part of type %T is not comparable; use an int, string, pointer, or comparable struct", part))
}
key = mountKeyNode{parent: key, part: part}
}
return key
}
|