diff options
Diffstat (limited to 'libgo/go/cmd/cgo/godefs.go')
-rw-r--r-- | libgo/go/cmd/cgo/godefs.go | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/libgo/go/cmd/cgo/godefs.go b/libgo/go/cmd/cgo/godefs.go index 64384a6..b4fd9c5 100644 --- a/libgo/go/cmd/cgo/godefs.go +++ b/libgo/go/cmd/cgo/godefs.go @@ -136,21 +136,31 @@ func gofmt(n interface{}) string { // (due to the printer possibly inserting newlines because of position // information) operators. var gofmtLineReplacer = strings.NewReplacer( - "{\n", "{", - ",\n", ",", + // Want to replace \n without ; after everything from + // https://golang.org/ref/spec#Operators_and_punctuation + // EXCEPT ++ -- ) ] } "++\n", "++;", "--\n", "--;", - "+\n", "+", - "-\n", "-", - "*\n", "*", - "/\n", "/", - "%\n", "%", - "&\n", "&", - "|\n", "|", - "^\n", "^", - "<\n", "<", - ">\n", ">", - "=\n", "=", + + "+\n", "+ ", + "-\n", "- ", + "*\n", "* ", + "/\n", "/ ", + "%\n", "% ", + "&\n", "& ", + "|\n", "| ", + "^\n", "^ ", + "<\n", "< ", + ">\n", "> ", + "=\n", "= ", + "!\n", "! ", // not possible in gofmt today + "(\n", "(", + "[\n", "[", // not possible in gofmt today + "{\n", "{", + ",\n", ",", + ".\n", ". ", + ":\n", ": ", // not possible in gofmt today + "\n", ";", ) |