Documentation ¶
Overview ¶
Package interfaceGUID exposes one function to calculate a unique identifier for an interface.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Calculate ¶
Calculate returns the hex encoded string of the SHA-256 hash of a reflected type, normally an interface.
The reflected type is traversed recursively up to all native types referenced. The value is dependent on the referenced type names, methods and their order. The name of the type itself is not taken in account.
The purpose of this function is to get into a quick common agreement between two remote parties, so that follow up communication can be done with gob or another communication mechanism.
See test cases for more details.
Example ¶
type Foo interface { Baz1(int) error Baz2() } fmt.Printf("%s\n", Calculate(reflect.TypeOf((*Foo)(nil)).Elem()))
Output: ee2fbefc01ff399e106213e5eab0f3a36c245f195195bd36a2058c115637e05d
Types ¶
This section is empty.