Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
|
|
|
|
nice side effect: slices now obey their format verb. example:
fmt.Printf("%q\n", []string{"a"})
R=rsc
CC=golang-dev
http://codereview.appspot.com/1729045
|
|
gob: substitute slice for map
R=r
CC=golang-dev
http://codereview.appspot.com/1699045
|
|
update other code to match.
R=r
CC=golang-dev
http://codereview.appspot.com/1680044
|
|
Fix a bug that caused it to ignore field widths.
R=rsc
CC=golang-dev
http://codereview.appspot.com/1704041
|
|
This shortens, simplifies and regularizes the code significantly.
(Improvements to reflect could make another step.)
Passes all.bash.
One semantic change occurs: The String() method changes
behavior. It used to run only for string formats such as %s and %q.
Instead, it now runs whenever the item has the method and the
result is then processed by the format as a string. Besides the
regularization, this has three effects:
1) width is honored for String() items
2) %x works for String() items
3) implementations of String that merely recur will recur forever
Regarding point 3, example from the updated documentation:
type X int
func (x X) String() string { return Sprintf("%d", x) }
should cast the value before recurring:
func (x X) String() string { return Sprintf("%d", int(x)) }
R=rsc
CC=golang-dev
http://codereview.appspot.com/1613045
|
|
Also fix an interface bug: white-space-delimited doesn't work well for cases like "%d, %d" on "23, 23")
R=rsc
CC=golang-dev
http://codereview.appspot.com/1502041
|
|
R=rsc
CC=golang-dev
http://codereview.appspot.com/1486041
|
|
- provide convenience functions for scanning strings
- enable Scanf etc.
- update doc comments
R=rsc
CC=golang-dev
http://codereview.appspot.com/1451044
|
|
Fixes issue 821.
R=rsc
CC=golang-dev
http://codereview.appspot.com/1434041
|
|
read from standard input. Add description of scanning to
the package comment.
R=rsc
CC=golang-dev
http://codereview.appspot.com/1390041
|
|
R=gri
CC=golang-dev
http://codereview.appspot.com/1326042
|
|
apply gofmt to src, misc
Fixes issue 752.
R=rsc
CC=golang-dev
http://codereview.appspot.com/1240044
Committer: Robert Griesemer <gri@golang.org>
|
|
R=rsc, r
CC=golang-dev
http://codereview.appspot.com/1195041
Committer: Rob Pike <r@golang.org>
|
|
R=r
CC=golang-dev, rsc
http://codereview.appspot.com/1014043
Committer: Rob Pike <r@golang.org>
|
|
fmt.Printf("%b", int8(-1)) prints 64 ones instead of 8.
This happens only for signed integers (int8, in16 and int32). I guess it's because of the way the conversion between integer types works. From go spec: "Conversions between integer types. If the value is a signed quantity, it is sign extended to implicit infinite precision ....". And there are several conversions to int64 and uint64 in the fmt package. This pathch solves only half of the problem. On a 32 bit system, an fmt.Printf("%b", int(-1)) should still print 64 ones.
R=golang-dev, r
CC=golang-dev
http://codereview.appspot.com/891049
Committer: Rob Pike <r@golang.org>
|
|
add tests.
R=rsc, ken2, ken3
CC=golang-dev
http://codereview.appspot.com/261041
|
|
R=r
CC=golang-dev
http://codereview.appspot.com/254043
|
|
8g and 5g have stubs to ignore complex
R=rsc
CC=golang-dev
http://codereview.appspot.com/257042
|
|
that pad() still counts bytes, but it's currently only used for
1 byte runes.
Fixes issue 612.
R=r
CC=golang-dev
http://codereview.appspot.com/217064
Committer: Rob Pike <r@golang.org>
|
|
R=gri
CC=golang-dev
http://codereview.appspot.com/223059
|
|
R=rsc
CC=golang-dev
http://codereview.appspot.com/224051
|
|
Try to avoid infinite recursion if String fails due to
printing a bad type.
Add test for String method with named basic types.
R=r
CC=golang-dev
http://codereview.appspot.com/207102
|
|
add some tests for erroneous formats.
R=rsc
CC=golang-dev
http://codereview.appspot.com/201058
|
|
R=rsc
CC=golang-dev
http://codereview.appspot.com/197043
|
|
- use an interface {Get()}
- implement Get for maps, slices
- for slices, retrieves the address of the end of the array, which will give the
same value for every slice of the same array.
R=rsc
CC=golang-dev
http://codereview.appspot.com/179129
|
|
(Also fix case sensitivity in test for PTR inside fmt_test.go)
Fixes issue 441.
R=rsc, iant
CC=golang-dev
http://codereview.appspot.com/180112
|
|
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
4) gofmt -w src misc test/bench
2nd set of files.
R=rsc
CC=golang-dev
http://codereview.appspot.com/179067
|
|
a couple of cleanups.
don't keep big buffers in the free list.
R=rsc
CC=golang-dev
http://codereview.appspot.com/166078
|
|
cleans up godoc's output for package fmt substantially.
R=rsc
CC=golang-dev
http://codereview.appspot.com/165070
|
|
Roughly 33% faster for simple cases, probably more for complex ones.
Before:
mallocs per Sprintf(""): 4
mallocs per Sprintf("xxx"): 6
mallocs per Sprintf("%x"): 10
mallocs per Sprintf("%x %x"): 12
Now:
mallocs per Sprintf(""): 2
mallocs per Sprintf("xxx"): 3
mallocs per Sprintf("%x"): 5
mallocs per Sprintf("%x %x"): 7
Speed improves because of avoiding mallocs and also by sharing a bytes.Buffer
between print.go and format.go rather than copying the data back after each
printed item.
Before:
fmt_test.BenchmarkSprintfEmpty 1000000 1346 ns/op
fmt_test.BenchmarkSprintfString 500000 3461 ns/op
fmt_test.BenchmarkSprintfInt 500000 3671 ns/op
Now:
fmt_test.BenchmarkSprintfEmpty 2000000 995 ns/op
fmt_test.BenchmarkSprintfString 1000000 2745 ns/op
fmt_test.BenchmarkSprintfInt 1000000 2391 ns/op
fmt_test.BenchmarkSprintfIntInt 500000 3751 ns/op
I believe there is more to get but this is a good milestone.
R=rsc
CC=golang-dev, hong
http://codereview.appspot.com/166076
|
|
R=r, gri
CC=golang-dev
http://codereview.appspot.com/156115
|
|
rsc's algorithm
- applied gofmt -w misc src
- partial CL (remaining files in other CLs)
R=rsc, r
http://go/go-review/1026036
|
|
R=rsc, r
http://go/go-review/1025029
|
|
- 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
|
|
(replacement for CLs 1017039, 1017041, 1017040, 1018054)
R=r
http://go/go-review/1018060
|
|
R=gri
OCL=35485
CL=35488
|
|
R=gri
DELTA=456 (6 added, 3 deleted, 447 changed)
OCL=35398
CL=35406
|
|
the last round omitted := range and only
checked 1 out of N vars in a multi-var :=
R=r
OCL=34624
CL=34638
|
|
R=r
DELTA=166 (0 added, 0 deleted, 166 changed)
OCL=34521
CL=34527
|
|
%E - upper case %e
%G - upper case %g
%#v - Go syntax
R=r
DELTA=332 (238 added, 47 deleted, 47 changed)
OCL=34091
CL=34145
|
|
for its format
Printf("%s", 2) gives %s(int=2)
R=rsc
DELTA=12 (10 added, 0 deleted, 2 changed)
OCL=34042
CL=34044
|
|
whole-package compilation. new Makefiles,
tests now in separate package
bytes
flag
fmt
io
math
once
os
reflect
strconv
sync
time
utf8
delete import "xxx" in package xxx.
inside package xxx, xxx is not declared
anymore so s/xxx.//g
delete file and package level forward declarations.
note the new internal_test.go and sync
and strconv to provide public access to
internals during testing. the installed version
of the package omits that file and thus does
not open the internals to all clients.
R=r
OCL=33065
CL=33097
|
|
R=r
DELTA=95 (0 added, 0 deleted, 95 changed)
OCL=33012
CL=33012
|
|
R=rsc
DELTA=1 (0 added, 0 deleted, 1 changed)
OCL=32591
CL=32593
|
|
R=rsc
DELTA=2 (0 added, 0 deleted, 2 changed)
OCL=32540
CL=32545
|
|
rename map access methods to Elem, SetElem.
R=r
DELTA=95 (66 added, 7 deleted, 22 changed)
OCL=31456
CL=31469
|