Skip to content

Commit

Permalink
gir/girgen/cmt: Drop back-compat whitespace hacks
Browse files Browse the repository at this point in the history
I added these in the previous commit so that the formatting would match
exactly.  Now that we've verified that there are no regressions, let's
drop them.
  • Loading branch information
LukeShu committed May 3, 2024
1 parent d2dfa59 commit 2ff08ba
Show file tree
Hide file tree
Showing 17 changed files with 3,337 additions and 11,669 deletions.
7 changes: 0 additions & 7 deletions gir/girgen/cmt/cmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ func goDoc(v interface{}, indentLvl int, opts []Option) string {
docBuilder.Reset()
docBuilder.WriteString(docStr)

baseLen := docBuilder.Len()
if len(inf.ParamDocs) > 0 {
writeParamDocs(&docBuilder,
"\n\nThe function takes the following parameters:\n",
Expand All @@ -273,7 +272,6 @@ func goDoc(v interface{}, indentLvl int, opts []Option) string {
"\n\nThe function returns the following values:\n",
inf.ReturnDocs)
}
hasTail := docBuilder.Len() > baseLen

cmt := convertMarkdownStringToGoDoc(docBuilder.String())

Expand All @@ -294,7 +292,6 @@ func goDoc(v interface{}, indentLvl int, opts []Option) string {
// gofmt step to turn them into tabs.
TextPrefix: strings.Repeat(" ", CommentsTabWidth*indentLvl) + "// ",
}
printer.TextCodePrefix = printer.TextPrefix + strings.Repeat(" ", CommentsTabWidth-1)
cmtStr := string(printer.Text(cmt))
cmtStr = transformLines(cmtStr, func(n, d int, line string) string {
if line == "" && n+1 != d {
Expand All @@ -303,10 +300,6 @@ func goDoc(v interface{}, indentLvl int, opts []Option) string {
return line
})

if hasTail && !synopsize && !strings.HasSuffix(cmtStr, "\n//\n") {
cmtStr += "//\n"
}

if !searchOptsBool(opts, trailingNewLine{}) {
cmtStr = strings.TrimSuffix(cmtStr, "\n")
}
Expand Down
Loading

0 comments on commit 2ff08ba

Please sign in to comment.