I understand golang does not support inheritance, but what is the right way to do in go for the following?
type CommonStruct struct{
ID string
}
type StructA struct{
CommonStruct
FieldA string
}
type StructB struct{
CommonStruct
FieldB string
}
func (s *CommonStruct) enrich(){
s.ID = IDGenerator()
}
how I can reuse the code in enrich for all other "sub struct" if the following function?
func doSomthing(s *CommoStruct){
s.enrich()
}