Commit 055f16a9 authored by Agniva De Sarker's avatar Agniva De Sarker Committed by Agniva De Sarker

cmd/doc: add a line gap after a method with no comment

Fixes #30492

Change-Id: Iec658bdf8bfac21e1bcc3eed900722cc535ec00a
Reviewed-on: https://go-review.googlesource.com/c/go/+/166178
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRob Pike <r@golang.org>
parent 6c6a0a1f
......@@ -496,6 +496,7 @@ var tests = []test{
`func ReturnExported\(\) ExportedType`,
`func \(ExportedType\) ExportedMethod\(a int\) bool`,
`Comment about exported method.`,
`func \(ExportedType\) Uncommented\(a int\) bool\n\n`, // Ensure line gap after method with no comment
},
[]string{
`unexportedType`,
......
......@@ -808,6 +808,9 @@ func (pkg *Package) typeDoc(typ *doc.Type) {
for _, fun := range funcs {
if isExported(fun.Name) {
pkg.emit(fun.Doc, fun.Decl)
if fun.Doc == "" {
pkg.newlines(2)
}
}
}
} else {
......
......@@ -80,6 +80,10 @@ func (ExportedType) ExportedMethod(a int) bool {
return true != true
}
func (ExportedType) Uncommented(a int) bool {
return true != true
}
// Comment about unexported method.
func (ExportedType) unexportedMethod(a int) bool {
return true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment