diff --git a/internal/go/printer/printer.go b/internal/go/printer/printer.go index a4897835..a2b9582f 100644 --- a/internal/go/printer/printer.go +++ b/internal/go/printer/printer.go @@ -609,7 +609,7 @@ func stripCommonPrefix(lines []string) { last := lines[len(lines)-1] closing := "*/" i := strings.Index(last, closing) // i >= 0 (closing is always present) - if isBlank(last[0:i]) { + if i >= 0 && isBlank(last[0:i]) { // last line only contains closing */ if lineOfStars { closing = " */" // add blank to align final star