-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspec.go
More file actions
35 lines (28 loc) · 726 Bytes
/
spec.go
File metadata and controls
35 lines (28 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//go:generate go-enum -f=$GOFILE --marshal
package inject
import (
"strings"
)
// ENUM(MODULE,PROVIDE,INJECT,INVOKE)
type AnnotationType int
// ENUM(MODULE,PATH,PACKAGE,FUNC)
type ModuleAttr int
// ENUM(DEFAULT,NAMED,GROUPED)
type AnnotationIDType int
type Annotation struct {
Index *int
Name string
Group string
}
func (a *Annotation) ID() string {
var fields []string
if a.Name == "" && a.Group == "" {
fields = append(fields, AnnotationIDTypeDEFAULT.String())
} else if a.Name != "" {
fields = append(fields, AnnotationIDTypeNAMED.String(), a.Name)
} else if a.Group != "" {
fields = append(fields, AnnotationIDTypeGROUPED.String(), a.Group)
}
return strings.ToLower(
strings.Join(fields, "_"))
}