]> Cypherpunks repositories - gostls13.git/commit
Add flag -tabindent to gofmt: forces use of
authorRobert Griesemer <gri@golang.org>
Thu, 3 Dec 2009 00:57:15 +0000 (16:57 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 3 Dec 2009 00:57:15 +0000 (16:57 -0800)
commitdc7355a97476257b62a6ff5a2884a3675da1828c
tree83c4c3281a29a48a85937b848114c4474c63981b
parente89441ba8f98e9ce679cbb06b7ab9106a32a63ce
Add flag -tabindent to gofmt: forces use of
tabs for indentation even if -spaces is set.

Changes to gofmt:
- added -tabindent flag
- don't recompute parser and printer mode repeatedly

Changes to go/printer:
- provide new printing mode TabIndent

Changes to tabwriter:
- implement new mode TabIndent to use tabs independent
  of the actual padding character for leading empty columns
- distinguish between minimal cell width and tab width
  (tabwidth is only used if the output contains tabs,
  minwidth and padding are always considered)
- fixed and added more comments
- some additional factoring

By default, -tabindent is disabled and the default gofmt
behavior is unchanged. By setting -spaces and -tabindent,
gofmt will use tabs for indentation but do any other
alignment with spaces. This permits a user to change the
visible indentation by simply changing the editor's tab
width and the code will remain properly aligned without
the need to rerun gofmt.

R=rsc
https://golang.org/cl/163068
src/cmd/gofmt/gofmt.go
src/pkg/go/printer/printer.go
src/pkg/tabwriter/tabwriter.go
src/pkg/tabwriter/tabwriter_test.go