I need to efficiently associate uniform data (whose size and structure is unknown at compile time) with some other data whose structure is unimportant. Slices can’t be used as map keys, and arrays don’t work for my use case because the size of my keys (while uniform) isn’t known at compile time.
Basically what I want to do is this:
package main
import "fmt"
func main() {
var x int = 3
key1 := [x]interface{}{1, "foo", true}
key2 := [x]interface{}{0, "baz", false}
m := map[interface{}]string{key1: "key1", key2: "key2"}
fmt.Println(m[[x]interface{}{1, "foo", true}])
}