]> Cypherpunks repositories - gostls13.git/commit
gofmt, go/printer: do not insert extra linebreaks where they may break the code
authorRobert Griesemer <gri@golang.org>
Fri, 14 Jan 2011 17:42:37 +0000 (09:42 -0800)
committerRobert Griesemer <gri@golang.org>
Fri, 14 Jan 2011 17:42:37 +0000 (09:42 -0800)
commit157cd6ef3af96b2b81e4f3a2b63063a20c67a406
tree1fb7377571257b7a1f0e1d8eff5b5ce7fc2de254
parenta093f3d5a03b790de027da4ec0fd6c29144c4d52
gofmt, go/printer: do not insert extra linebreaks where they may break the code

Introduced a printer mode (pmode) type and corresponding
pmode values which permit easy toggling of the current
printer mode for fine-tuning of layout.

Use the printer mode to disable potential introduction of
line breaks before a closing '}' in composite literals.

Added extra test case. Applied gofmt to src and misc.

Fixes #1365.

R=r2
CC=golang-dev
https://golang.org/cl/4008041
src/pkg/go/printer/nodes.go
src/pkg/go/printer/printer.go
src/pkg/go/printer/testdata/comments.golden
src/pkg/go/printer/testdata/comments.input