我想在导出结构中使用的嵌套导出结构中添加一个方法。我有一个由ldap.Search().Entries返回的[]*ldap.Entry类型ldap.Entry类型由Attributes[]*EntryAttribute组成。我的目标是在ldap.EntryAttribute中添加一个额外的方法,例如MarshalJSON我可以将额外的代码直接添加到ldap包中,它会按我预期的那样工作。但这是一种肮脏的方式://EntryAttributeholdsasingleattributetypenewEntryAttributestruct{//Nameisthenameoftheattrib