route/vendor/github.com/mitchellh/hashstructure/hashstructure_examples_test.go

33 lines
476 B
Go

package hashstructure
import (
"fmt"
)
func ExampleHash() {
type ComplexStruct struct {
Name string
Age uint
Metadata map[string]interface{}
}
v := ComplexStruct{
Name: "mitchellh",
Age: 64,
Metadata: map[string]interface{}{
"car": true,
"location": "California",
"siblings": []string{"Bob", "John"},
},
}
hash, err := Hash(v, nil)
if err != nil {
panic(err)
}
fmt.Printf("%d", hash)
// Output:
// 6691276962590150517
}