mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: don't force rewritten code onto a single line
Doing that appears to have been a mistake in CL 142883. Fixes #67517 Change-Id: Iec6b897984a2e27ec596fc3c4c8129e9620afab1 Reviewed-on: https://go-review.googlesource.com/c/go/+/586676 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
7ffa8d0a5b
commit
4edb367bac
5 changed files with 51 additions and 46 deletions
|
|
@ -924,7 +924,7 @@ func (p *Package) rewriteCall(f *File, call *Call) (string, bool) {
|
|||
if rtype != name.FuncType.Result.Go {
|
||||
needsUnsafe = true
|
||||
}
|
||||
sb.WriteString(gofmtLine(rtype))
|
||||
sb.WriteString(gofmt(rtype))
|
||||
result = true
|
||||
}
|
||||
|
||||
|
|
@ -960,7 +960,7 @@ func (p *Package) rewriteCall(f *File, call *Call) (string, bool) {
|
|||
needsUnsafe = true
|
||||
}
|
||||
fmt.Fprintf(&sb, "var _cgo%d %s = %s; ", i,
|
||||
gofmtLine(ptype), gofmtPos(arg, origArg.Pos()))
|
||||
gofmt(ptype), gofmtPos(arg, origArg.Pos()))
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
@ -1682,7 +1682,7 @@ func (p *Package) rewriteName(f *File, r *Ref, addPosition bool) ast.Expr {
|
|||
// gofmtPos returns the gofmt-formatted string for an AST node,
|
||||
// with a comment setting the position before the node.
|
||||
func gofmtPos(n ast.Expr, pos token.Pos) string {
|
||||
s := gofmtLine(n)
|
||||
s := gofmt(n)
|
||||
p := fset.Position(pos)
|
||||
if p.Column == 0 {
|
||||
return s
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue