Skip to content

Commit 83afe04

Browse files
authored
Merge pull request #1388 from Adirio/scaffold-enhancement/file-update-nits
NITs raised in 1375
2 parents 8195557 + 232a8d0 commit 83afe04

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pkg/model/file/interfaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type Template interface {
4040
Builder
4141
// GetBody returns the template body
4242
GetBody() string
43-
// SetTemplateDefaults returns the TemplateMixin for creating a scaffold file
43+
// SetTemplateDefaults sets the default values for templates
4444
SetTemplateDefaults() error
4545
}
4646

pkg/model/file/marker.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@ var commentsByExt = map[string]string{
2828
// this is a backwards incompatible change, and thus should be done for next project version.
2929
".go": "// ",
3030
".yaml": "# ",
31+
// When adding additional file extensions, update also the NewMarkerFor documentation and error
3132
}
3233

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
3435
type Marker struct {
3536
comment string
3637
value string
3738
}
3839

3940
// NewMarkerFor creates a new marker customized for the specific file
41+
// Supported file extensions: .go, .ext
4042
func NewMarkerFor(path string, value string) Marker {
4143
ext := filepath.Ext(path)
4244
if comment, found := commentsByExt[ext]; found {
@@ -51,6 +53,9 @@ func (m Marker) String() string {
5153
return m.comment + prefix + m.value
5254
}
5355

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
5458
type CodeFragments []string
5559

60+
// CodeFragmentsMap binds Markers and CodeFragments together
5661
type CodeFragmentsMap map[Marker]CodeFragments

0 commit comments

Comments
 (0)