File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ type Template interface {
40
40
Builder
41
41
// GetBody returns the template body
42
42
GetBody () string
43
- // SetTemplateDefaults returns the TemplateMixin for creating a scaffold file
43
+ // SetTemplateDefaults sets the default values for templates
44
44
SetTemplateDefaults () error
45
45
}
46
46
Original file line number Diff line number Diff line change @@ -28,15 +28,17 @@ var commentsByExt = map[string]string{
28
28
// this is a backwards incompatible change, and thus should be done for next project version.
29
29
".go" : "// " ,
30
30
".yaml" : "# " ,
31
+ // When adding additional file extensions, update also the NewMarkerFor documentation and error
31
32
}
32
33
33
- // Marker represents a comment LoC that will be used to insert code fragments by update operations
34
+ // Marker represents a machine-readable comment that will be used for scaffolding purposes
34
35
type Marker struct {
35
36
comment string
36
37
value string
37
38
}
38
39
39
40
// NewMarkerFor creates a new marker customized for the specific file
41
+ // Supported file extensions: .go, .ext
40
42
func NewMarkerFor (path string , value string ) Marker {
41
43
ext := filepath .Ext (path )
42
44
if comment , found := commentsByExt [ext ]; found {
@@ -51,6 +53,9 @@ func (m Marker) String() string {
51
53
return m .comment + prefix + m .value
52
54
}
53
55
56
+ // CodeFragments represents a set of code fragments
57
+ // A code fragment is a piece of code provided as a Go string, it may have multiple lines
54
58
type CodeFragments []string
55
59
60
+ // CodeFragmentsMap binds Markers and CodeFragments together
56
61
type CodeFragmentsMap map [Marker ]CodeFragments
You can’t perform that action at this time.
0 commit comments