summaryrefslogtreecommitdiff
path: root/scratchdir/hashbydata.go
blob: 83874f3c901c7a99784dfe3be9fb32070ece8b97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package main

import "fmt"

type (
	empty struct{}
	t     interface{}
	set   map[t]empty
)

func main() {
	m := make(map[t]string)
	fmt.Println(fmt.Sprintf("%+v", m))
	m[struct{ x string }{x: "hello there"}] = "hello there"
	fmt.Println(fmt.Sprintf("%+v", m))

	m[struct{ x string }{x: "hello there"}] = "goodbye"
	fmt.Println(fmt.Sprintf("%+v", m))

	ptr := &struct{ x string }{x: "hello there"}
	pv := *ptr
	m[pv] = "ptr"
	fmt.Println(fmt.Sprintf("%+v", m))
}