summaryrefslogtreecommitdiff
path: root/src/pkg/go
AgeCommit message (Collapse)AuthorFilesLines
2009-12-10implement NoSemis and NoStringConcat mode for go/printerRobert Griesemer2-5/+22
R=rsc http://codereview.appspot.com/174050
2009-12-10implemented InsertSemis mode for go/scannerRobert Griesemer2-20/+236
R=rsc http://codereview.appspot.com/175047
2009-12-09remove uses of string concatenation from src and misc directoryRobert Griesemer2-11/+10
R=rsc http://codereview.appspot.com/172041
2009-12-07the AST walker currently provides no way to find out how theRoger Peppe1-54/+55
nodes in the tree are nested with respect to one another. a simple change to the Visitor interface makes it possible to do this (for example to maintain a current node-depth, or a knowledge of the name of the current function). Visit(nil) is called at the end of a node's children; this make possible the channel-based interface below, amongst other possibilities. It is still just as simple to get the original behaviour - just return the same Visitor from Visit. Here are a couple of possible Visitor types. // closure-based type FVisitor func(n interface{}) FVisitor func (f FVisitor) Visit(n interface{}) Visitor { return f(n); } // channel-based type CVisitor chan Visit; type Visit struct { node interface{}; reply chan CVisitor; }; func (v CVisitor) Visit(n interface{}) Visitor { if n == nil { close(v); } else { reply := make(chan CVisitor); v <- Visit{n, reply}; r := <-reply; if r == nil { return nil; } return r; } return nil; } R=gri CC=rsc http://codereview.appspot.com/166047 Committer: Robert Griesemer <gri@golang.org>
2009-12-03- include type-associated consts and vars when filtering a PackageDocRobert Griesemer1-7/+9
- fixes a godoc issue (for instance, "godoc os EOF" now shows an entry) R=r CC=rsc http://codereview.appspot.com/165042
2009-12-02move ReadFile, WriteFile, and ReadDir into a separate io/ioutil package.Rob Pike2-5/+6
this breaks the dependency of package io on package bytes. R=rsc CC=golang-dev http://codereview.appspot.com/163085
2009-12-02Add flag -tabindent to gofmt: forces use ofRobert Griesemer1-2/+11
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 http://codereview.appspot.com/163068
2009-11-29Correct expression level for argument lists.Robert Griesemer2-0/+3
Fixes issue 352. R=rsc http://codereview.appspot.com/161073
2009-11-24Handle presence of illegal semicolon after package clause better.Robert Griesemer1-0/+8
R=r, r1 http://codereview.appspot.com/157167
2009-11-24Change to container/vector interface:Robert Griesemer4-36/+27
- removed New(len int) in favor of new(Vector).Resize(len, cap) - removed Init(len int) in favor of Resize(len, cap) - runs all.bash Fixes issue 294. R=rsc, r, r1 http://codereview.appspot.com/157143
2009-11-23go: makes it build for the case $GOROOT has whitespacesSergio Luis O. B. Correia6-12/+12
the bash scripts and makefiles for building go didn't take into account the fact $GOROOT / $GOBIN could both be directories containing whitespaces, and was not possible to build it in such a situation. this commit adjusts the various makefiles/scripts to make it aware of that possibility, and now it builds successfully when using a path with whitespaces as well. Fixes issue 115. R=rsc, dsymonds1 http://codereview.appspot.com/157067 Committer: Russ Cox <rsc@golang.org>
2009-11-23gofmt -r: documentation and minor fixesRuss Cox1-13/+23
fix a few paren insertion bugs in the printer too. R=gri, r CC=golang-dev http://codereview.appspot.com/157119
2009-11-20gofmt: add -r flag to rewrite source code according to patternRuss Cox1-3/+13
a little slow, but usable (speed unchanged when not using -r) tweak go/printer to handle nodes without line numbers more gracefully in a couple cases. R=gri http://codereview.appspot.com/156103
2009-11-20gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkgRuss Cox4-12/+12
R=r, gri CC=golang-dev http://codereview.appspot.com/156115
2009-11-19Permit omission of hi bound in slices.Robert Griesemer7-16/+57
R=r, rsc http://codereview.appspot.com/157082
2009-11-09- minor cleanupsRobert Griesemer2-20/+19
- better debugging support - gofmt -l src misc | wc -l is 0 R=rsc http://go/go-review/1024042
2009-11-09 - replaced gofmt expression formatting algorithm withRobert Griesemer16-216/+515
rsc's algorithm - applied gofmt -w misc src - partial CL (remaining files in other CLs) R=rsc, r http://go/go-review/1026036
2009-11-09remove semis after statements in one-statement statement listsRobert Griesemer21-626/+626
R=rsc, r http://go/go-review/1025029
2009-11-09- rename Context to exprContext to remove it from public interfaceRobert Griesemer1-4/+4
(and to match the style of declContext) R=rsc http://go/go-review/1024033
2009-11-09fix for nodeSize computation, used to determine ifRobert Griesemer1-1/+5
a node fits on one line: - for purposes of measuring the node size in text, don't generate html or use a styler that could generate html as it will lead to overly large sizes A consequence of this bug is that source code displayed with godoc may show functions that fit on one line in the source on multiple lines. This change causes no difference to the gofmt formatting of any files in src or misc. R=rsc http://go/go-review/1026034
2009-11-08a nagging inconsistency: capitalization ofRuss Cox1-11/+11
HTML vs Html, URL vs Url, HTTP vs Http, current source is 6:1 in favor of the former, so change instances of the latter. R=r CC=go-dev http://go/go-review/1024026
2009-11-08assorted cleanupRuss Cox2-30/+12
R=r, iant CC=go-dev http://go/go-review/1025024
2009-11-08added package documentationRobert Griesemer1-0/+1
R=r, rsc http://go/go-review/1025023
2009-11-07- blank before opening { for multi-line composite literals (as preferred by r)Robert Griesemer1-14/+37
- blank padding around composite literal contents for a less dense look (most if not all composite literals were written in that style before gofmt ran through them) - corresponding (internal) flag: compositeLitBlank - don't print a semi after a one-statement statement list (as preferred by r) - corresponding (internal flag): fewerSemis - the number of changes in nodes.go is huge because of the removed semis; hg mail requires that I gofmt the file before With both flags set to false, this CL causes no gofmt formatting change. We can turn them on if we like it (and then remove the flags). Will submit with flags disabled. R=rsc, r http://go/go-review/1025015
2009-11-06format composite literal types that are "short" struct type literalsRobert Griesemer4-21/+123
on one line for a more compact representation of some composite Literals R=rsc http://go/go-review/1025008
2009-11-06- fine-tuning of one-line func heuristic (nodes.go)Robert Griesemer13-273/+153
- enabled for function declarations (not just function literals) - applied gofmt -w $GOROOT/src (look for instance at src/pkg/debug/elf/elf.go) R=r, rsc CC=go-dev http://go/go-review/1026006
2009-11-05gofmt the last outstanding files in src/pkgRobert Griesemer3-227/+255
- added a list of issues to printer/nodes.go R=rsc http://go/go-review/1024002
2009-11-05fix a comment formatting bug:Robert Griesemer3-2/+22
- this ensures better comment formatting in template.go and codec_test.go - it affects only 2 files of all files that have been gofmt'ed already, see separate CL (it fixes the same issue in those files) R=rsc http://go/go-review/1023002
2009-11-05gofmt'ed parts of goRobert Griesemer3-127/+137
R=rsc http://go/go-review/1023001
2009-11-052nd attempt: no noIndent for string listsRobert Griesemer5-20/+133
- slightly better output in general - extra indentation where we could do without (however that seems better for now that not having the indentation where it is needed) - no information is lost, so a future better approach can fix these places up again R=rsc http://go/go-review/1017050
2009-11-04more comment formatting:Robert Griesemer3-24/+160
- preserve (some) indentation of comment text for /*-style comments even if the first comment line does not contain any text that might suggest the "correct" indentation - enabled because otherwise existing larger comments get re-formatted (this will not introduce a lot of changes since comments of this kind - until now - were not changed with respect to indentation) R=rsc http://go/go-review/1016047
2009-11-04- add a blank before the opening { for multi-line compositesRobert Griesemer1-2/+15
(request by r) - feature temporarily disabled R=rsc CC=r http://go/go-review/1018052
2009-11-04gofmt-ify src/pkg/go (excluding printer directory due to pending CL,Robert Griesemer7-237/+285
and parser.go and scanner_test.go which have minor formatting issues) R=rsc http://go/go-review/1016042
2009-11-04rename testfiles from .go -> .orig so that they won't beRobert Griesemer7-8/+8
picked up by gofmt (they should not be modified) or godoc (testdata should not be considered a potential package directory) R=rsc http://go/go-review/1018045
2009-11-04better placement of /*-style comments interspersed with code on one lineRobert Griesemer4-10/+33
R=rsc http://go/go-review/1017030
2009-11-04- always format blocks with closing } on a new line, even if emptyRobert Griesemer4-54/+95
- at the moment this also affects single-line function declarations because we have disabled them at the moment (but not single-line function literals) R=rsc http://go/go-review/1016040
2009-11-04- complete html-escaping also in printer.goRobert Griesemer1-7/+12
R=rsc http://go/go-review/1017027
2009-11-04- respect source line breaks in grouped declarationsRobert Griesemer4-17/+120
- made ast.Spec nodes implement Node interface - added extra test cases R=rsc http://go/go-review/1016038
2009-11-03Note: This is an exact replica and replacement of CL 1018027Robert Griesemer1-0/+18
(which I uploaded at home and thus can't upload from here). CL 1018027 was reviewed. - added comments to scope.go - commented out some code that is not yet needed (and which showed up prominently in the documentation) R=rsc http://go/go-review/1017017
2009-11-03- don't loose extra line breaks in struct/interface declarationsRobert Griesemer4-11/+121
- start new sections if a field/method declaration spans multiple lines; this avoids tabs from the previous line affecting the next field/method R=rsc http://go/go-review/1017015
2009-11-02split printer.go into two files; it has become too large:Robert Griesemer3-1070/+1085
- nodes.go implements ast node formatting - printer.go implements the core printing functionality and public interface No code changes except for updating the import clauses and adding a top-level comment to nodes.go. R=rsc http://go/go-review/1016026
2009-11-02use the new routine regexp.MustCompile to clean up some code that uses ↵Rob Pike1-15/+2
global regexps. R=rsc, gri CC=go-dev http://go/go-review/1016025
2009-11-02- collect line comments for methods in interfacesRobert Griesemer2-12/+11
(previously not shown in godoc) - simplify parsing of struct types (match code structure for parsing interface types) R=rsc, r http://go/go-review/1016019
2009-11-01reverse the arguments to io.Copy so the destination is on theRob Pike1-1/+1
left, like an assignment, like strcpy, etc. R=rsc CC=go-dev http://go/go-review/1016011
2009-10-30improved comment formatting:Robert Griesemer8-168/+637
- print comments line by line, strip common prefix but do not modify comment contents otherwise - align comments with subsequent keyword if indicated (e.g. case labels) - terminate "column section" after multi-line expressions for better alignment R=rsc http://go/go-review/1017002
2009-10-28fix for long label names impacting column width of previous linesRobert Griesemer3-1/+40
R=rsc http://go/go-review/1013017
2009-10-27files that are okay from the last gofmt roundRuss Cox1-4/+4
R=gri http://go/go-review/1015011
2009-10-26- gofmt-ify walk.goRobert Griesemer1-44/+67
- fixed several bugs R=rsc http://go/go-review/1015015
2009-10-22Fix printer_test.go to invoke Fprint as a method of cfg.Ian Lance Taylor1-1/+1
This matches the change to printer.go in revision 3632. R=gri http://go/go-review/1015001
2009-10-22- make printer interface easily extensible w/o breaking clients (in the future)Robert Griesemer2-64/+73
- replacement for p4 CL 35999 (abandoned) R=rsc http://go/go-review/1012010