package annotation // @Inject(name? string) import ( "fmt" "reflect" ) const ( InjectTag = "@Inject" ) func init() { registerAnnotation(InjectTag, reflect.TypeOf((*Inject)(nil))) } type Inject struct { Annotation Name string } func (a *Inject) parseAttribute(attributes map[string]string) error { for k, v := range attributes { switch k { case "name": a.Name = v default: return fmt.Errorf("Syntax error: not supported attribute[%s]", k) } } return nil }