Skip to content

Instantly share code, notes, and snippets.

@sttts
Created July 14, 2019 14:43
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 sttts/405114732c771c4a6fd6f9f98114b748 to your computer and use it in GitHub Desktop.
Save sttts/405114732c771c4a6fd6f9f98114b748 to your computer and use it in GitHub Desktop.
func init() {
localSchemeBuilder.Register(RegisterConversions)
}
// RegisterConversions adds conversion functions to the given
// scheme. Public to allow building arbitrary schemes.
func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*Topping)(nil),
(*restaurant.Topping)(nil),
func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_Topping_To_restaurant_Topping(
a.(*Topping),
b.(*restaurant.Topping),
scope,
)
},
); err != nil {
return err
}
...
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment