1
0
mirror of https://github.com/golang/go synced 2024-09-29 17:24:34 -06:00

cmd/cgo: removes new line for exported functions

removes an unnecessary new line that was being added between a cgo
exported function and it's documentation block in the generated
header file when the documentation block already ended with a new
line

Fixes #37722
This commit is contained in:
Nathan Fiscaletti 2020-03-06 17:20:23 -06:00 committed by Nathan Fiscaletti
parent 1d90e1a0ac
commit 9fbe1c1d80

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")