1
0
mirror of https://github.com/golang/go synced 2024-11-17 10:54:50 -07:00

cmd/cgo: avoid extra newline in doc comment of exported function

Fixes #37722

Change-Id: Ie9154f9d91824558a8ac34ad2fb5bc4e02c64a4b
GitHub-Last-Rev: 9fbe1c1d80
GitHub-Pull-Request: golang/go#37723
Reviewed-on: https://go-review.googlesource.com/c/go/+/222419
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Nathan Fiscaletti 2020-03-07 05:44:31 +00:00 committed by Ian Lance Taylor
parent ae3f98c51b
commit a7f918c1a5

View File

@ -921,8 +921,11 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
if len(exp.Doc) > 0 {
fmt.Fprintf(fgcch, "\n%s", exp.Doc)
if !strings.HasSuffix(exp.Doc, "\n") {
fmt.Fprint(fgcch, "\n")
}
}
fmt.Fprintf(fgcch, "\nextern %s;\n", s)
fmt.Fprintf(fgcch, "extern %s;\n", s)
fmt.Fprintf(fgcc, "extern void _cgoexp%s_%s(void *, int, __SIZE_TYPE__);\n", cPrefix, exp.ExpName)
fmt.Fprintf(fgcc, "\nCGO_NO_SANITIZE_THREAD")