Skip to content

Commit ab2b63f

Browse files
authored
fix: line breaks for Go doc convention (#42)
* fix: fix line breaks for Go doc convention * build: update generated vips package * add back full stop * build: update generated vips package
1 parent 9527fef commit ab2b63f

File tree

5 files changed

+845
-654
lines changed

5 files changed

+845
-654
lines changed

internal/generator/templatefunc.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,23 +1011,29 @@ func generateImageArgumentsComment(op introspection.Operation) string {
10111011
var result strings.Builder
10121012

10131013
if len(methodArgs) > 0 {
1014+
// Add blank comment line for paragraph break only if there are arguments
1015+
result.WriteString("\n//")
1016+
10141017
for _, arg := range methodArgs {
10151018
if arg.IsInputN {
10161019
continue
10171020
}
10181021
if arg.Description != "" {
10191022
cleanDesc := strings.TrimSpace(arg.Description)
10201023
if cleanDesc != "" {
1021-
// Ensure description starts with lowercase and ends with period
10221024
if len(cleanDesc) > 0 {
10231025
cleanDesc = strings.ToLower(string(cleanDesc[0])) + cleanDesc[1:]
1026+
if !strings.HasSuffix(cleanDesc, ".") {
1027+
cleanDesc += "."
1028+
}
10241029
}
1030+
10251031
result.WriteString(fmt.Sprintf("\n// The %s specifies %s", arg.GoName, cleanDesc))
10261032
}
10271033
}
10281034
}
10291035
}
1030-
return result.String()
1036+
return result.String() // Returns empty string if no arguments
10311037
}
10321038

10331039
// detectMethodArguments analyzes an operation's arguments to determine which should be included in the method signature

0 commit comments

Comments
 (0)