Calculates a unique hash based identifier for a Go interface.
Go
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.travis.yml
LICENSE
README.md
interface_guid.go
interface_guid_test.go

README.md

interfaceGUID

interfaceGUID exposes a single function CalculateGUID which calculates a unique deterministic value based on the type provided. It is to be used when communicating with remote services to quickly assert common knowledge before starting to communicate, for example via encoding/gob.

GoDoc Build Status Coverage Status

Example

type MyService interface {
  ...
}

guid := interfaceGUID.CalculateGUID(reflect.TypeOf((*MyService)(nil)).Elem())
// Then compare the string with the remote service.