Skip to content

Instantly share code, notes, and snippets.

@cep21
Created July 25, 2017 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cep21/7a3d03e47d1aafb2f1fe72ac4c97eca3 to your computer and use it in GitHub Desktop.
Save cep21/7a3d03e47d1aafb2f1fe72ac4c97eca3 to your computer and use it in GitHub Desktop.
type I interface {
Func()
}
type I2 interface {
Another()
}
type I3 interface {
Func()
Another()
}
// If half the functinos are in the base struct
type Iimpl struct{}
func (i *Iimpl) Func(){}
// And half are in the larger struct
type I2impl struct{
wraps(Iimpl)
}
func (i *I2impl) Another(){}
x := I2impl{}
// Does that struct implement the combination interface?
_, isBoth := x.(I3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment