An error occurred fetching the project authors.
- 29 May, 2013 1 commit
-
-
Rob Pike authored
The old code put the index before the period in the precision; it should be after so it's always before the star, as documented. A little trickier to do in one pass but compensated for by more tests and catching a couple of other error cases. R=rsc CC=golang-dev https://golang.org/cl/9751044
-
- 24 May, 2013 1 commit
-
-
Rob Pike authored
This text is added to doc.go: Explicit argument indexes: In Printf, Sprintf, and Fprintf, the default behavior is for each formatting verb to format successive arguments passed in the call. However, the notation [n] immediately before the verb indicates that the nth one-indexed argument is to be formatted instead. The same notation before a '*' for a width or precision selects the argument index holding the value. After processing a bracketed expression [n], arguments n+1, n+2, etc. will be processed unless otherwise directed. For example, fmt.Sprintf("%[2]d %[1]d\n", 11, 22) will yield "22, 11", while fmt.Sprintf("%[3]*[2].*[1]f", 12.0, 2, 6), equivalent to fmt.Sprintf("%6.2f", 12.0), will yield " 12.00". Because an explicit index affects subsequent verbs, this notation can be used to print the same values multiple times by resetting the index for the first argument to be repeated: fmt.Sprintf("%d %d %#[1]x %#x", 16, 17) will yield "16 17 0x10 0x11". The notation chosen differs from that in C, but I believe it's easier to read and to remember (we're indexing the arguments), and compatibility with C's printf was never a strong goal anyway. While we're here, change the word "field" to "arg" or "argument" in the code; it was being misused and was confusing. R=rsc, bradfitz, rogpeppe, minux.ma, peter.armitage CC=golang-dev https://golang.org/cl/9680043
-
- 29 Apr, 2013 1 commit
-
-
Rob Pike authored
Fixes #5311 R=golang-dev, bradfitz, iant CC=golang-dev https://golang.org/cl/8961050
-
- 10 Apr, 2013 1 commit
-
-
Rob Pike authored
The String method is called whenever the printing operation wants a string, not just for %s and %v. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/8638043
-
- 20 Feb, 2013 1 commit
-
-
Robert Dinu authored
Apply width when using Printf with nil values. Fixes #4772. R=r, adg CC=golang-dev https://golang.org/cl/7314114
-
- 31 Jan, 2013 1 commit
-
-
Robert Daniel Kortschak authored
Fixes #4685. R=golang-dev, adg, remyoudompheng, rsc CC=golang-dev https://golang.org/cl/7205047
-
- 22 Jan, 2013 1 commit
-
-
Robin Eklind authored
R=minux.ma, dave, rsc CC=golang-dev https://golang.org/cl/7064055
-
- 25 Dec, 2012 1 commit
-
-
Oling Cat authored
R=golang-dev, iant CC=golang-dev, minux.ma https://golang.org/cl/6998055
-
- 30 Oct, 2012 1 commit
-
-
Robert Griesemer authored
Remove trailing whitespace in comments. No other changes. R=r CC=golang-dev https://golang.org/cl/6815053
-
- 26 Sep, 2012 1 commit
-
-
Rob Pike authored
Silly and small but easy to be consistent. To make it worthwhile, I eliminated an allocation when using %x on a byte slice. Fixes #4149. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6574046
-
- 17 Aug, 2012 1 commit
-
-
Rob Pike authored
Before, pointers always appeared as 0x1234ABCD. This CL keeps that as the default for %p and %v, but lets explicit numeric verbs override the default. Fixes #3936. R=golang-dev, iant CC=golang-dev https://golang.org/cl/6441152
-
- 25 Jun, 2012 1 commit
-
-
Rob Pike authored
Fixes #3752. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6331062
-
- 06 Jun, 2012 1 commit
-
-
Russ Cox authored
The reordering speedup in CL 6245068 changed the semantics of %#v by delaying the clearing of some flags. Restore the old semantics and add a test. Fixes #3706. R=golang-dev, r CC=golang-dev https://golang.org/cl/6302048
-
- 29 May, 2012 1 commit
-
-
Rob Pike authored
The check for Stringer etc. can only fire if the test is not a builtin, so avoid the expensive check if we know there's no chance. Also put in a fast path for pad, which saves a more modest amount. benchmark old ns/op new ns/op delta BenchmarkSprintfEmpty 148 152 +2.70% BenchmarkSprintfString 585 497 -15.04% BenchmarkSprintfInt 441 396 -10.20% BenchmarkSprintfIntInt 718 603 -16.02% BenchmarkSprintfPrefixedInt 676 621 -8.14% BenchmarkSprintfFloat 1003 953 -4.99% BenchmarkManyArgs 2945 2312 -21.49% BenchmarkScanInts 1704152 1734441 +1.78% BenchmarkScanRecursiveInt 1837397 1828920 -0.46% R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/6245068
-
- 07 Mar, 2012 1 commit
-
-
Russ Cox authored
$ go list -f '{{.ImportPath}} {{.Deps}}' fmt log fmt [errors io math os reflect runtime strconv sync sync/atomic syscall time unicode/utf8 unsafe] log [errors fmt io math os reflect runtime strconv sync sync/atomic syscall time unicode/utf8 unsafe] R=bradfitz, rogpeppe, r, r, rsc CC=golang-dev https://golang.org/cl/5753055
-
- 08 Feb, 2012 1 commit
-
-
Russ Cox authored
Fixes #2851. R=golang-dev, r CC=golang-dev https://golang.org/cl/5644048
-
- 15 Dec, 2011 2 commits
-
-
Rob Pike authored
%g down to two mallocs from four. Also a mild speedup. fmt_test.BenchmarkSprintfFloat 3016 2703 -10.38% Fixes #2557. R=rsc CC=golang-dev https://golang.org/cl/5491054
-
Rob Pike authored
Fixes #2555. R=golang-dev, dsymonds, r CC=golang-dev https://golang.org/cl/5486076
-
- 06 Dec, 2011 1 commit
-
-
Rob Pike authored
This is a slight change to fmt's semantics, but means that if you use %d to print an integer with a Stringable value, it will print as an integer. This came up because Time.Month() couldn't cleanly print as an integer rather than a name. Using %d on Stringables is silly anyway, so there should be no effect outside the fmt tests. As a mild bonus, certain recursive failures of String methods will also be avoided this way. R=golang-dev, adg CC=golang-dev https://golang.org/cl/5453053
-
- 23 Nov, 2011 1 commit
-
-
Rémy Oudompheng authored
Also add array values to printing test suite. Fixes #2468. R=golang-dev, r CC=golang-dev, remy https://golang.org/cl/5436053
-
- 14 Nov, 2011 1 commit
-
-
Russ Cox authored
Also update Scanf tests to cope with DeepEqual distinguishing empty vs nil slice. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5375091
-
- 08 Nov, 2011 1 commit
-
-
Rob Pike authored
R=rsc CC=golang-dev https://golang.org/cl/5358041
-
- 02 Nov, 2011 2 commits
-
-
Russ Cox authored
R=adg CC=golang-dev https://golang.org/cl/5328062
-
Russ Cox authored
R=golang-dev, iant CC=golang-dev https://golang.org/cl/5322051
-
- 28 Oct, 2011 1 commit
-
-
Russ Cox authored
Handling os.Error is no different than handling fmt.Stringer here, so the code is redundant now, but it will be necessary once error goes in. Adding it now will make gofix fix it. R=r CC=golang-dev https://golang.org/cl/5331045
-
- 26 Oct, 2011 1 commit
-
-
Russ Cox authored
Lots of internal edits. Formatter and Scanner interfaces change (clients to be checked by govet). R=r CC=golang-dev https://golang.org/cl/5305045
-
- 21 Oct, 2011 1 commit
-
-
Rob Pike authored
R=rsc CC=golang-dev https://golang.org/cl/5293058
-
- 19 Oct, 2011 1 commit
-
-
Gustavo Niemeyer authored
R=golang-dev, r CC=golang-dev https://golang.org/cl/5296044
-
- 18 Oct, 2011 1 commit
-
-
Rob Pike authored
Store the reflect.Value in the internal print state. Code is simpler, cleaner, and a little faster - back to what it was before the change. R=golang-dev, iant CC=golang-dev https://golang.org/cl/5299046
-
- 17 Oct, 2011 1 commit
-
-
Russ Cox authored
Had been allowing it for use by fmt, but it is too hard to lock down. Fix other packages not to depend on it. R=r, r CC=golang-dev https://golang.org/cl/5266054
-
- 12 Oct, 2011 1 commit
-
-
Rob Pike authored
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5229057
-
- 29 Sep, 2011 1 commit
-
-
Rob Pike authored
Simpler concept, and it turns a queue into a stack. Speeds up benchmarks noticeably. Before: fmt_test.BenchmarkSprintfEmpty 10000000 282 ns/op fmt_test.BenchmarkSprintfString 2000000 910 ns/op fmt_test.BenchmarkSprintfInt 5000000 723 ns/op fmt_test.BenchmarkSprintfIntInt 1000000 1071 ns/op fmt_test.BenchmarkSprintfPrefixedInt 1000000 1108 ns/op fmt_test.BenchmarkScanInts 1000 2239510 ns/op fmt_test.BenchmarkScanRecursiveInt 1000 2365432 ns/op After: fmt_test.BenchmarkSprintfEmpty 10000000 232 ns/op fmt_test.BenchmarkSprintfString 2000000 837 ns/op fmt_test.BenchmarkSprintfInt 5000000 590 ns/op fmt_test.BenchmarkSprintfIntInt 2000000 910 ns/op fmt_test.BenchmarkSprintfPrefixedInt 2000000 996 ns/op fmt_test.BenchmarkScanInts 1000 2210715 ns/op fmt_test.BenchmarkScanRecursiveInt 1000 2367800 ns/op R=rsc, r CC=golang-dev https://golang.org/cl/5151044
-
- 21 Jul, 2011 1 commit
-
-
Michael T. Jones authored
The C-stdlib heritage of printf/fprintf/sprintf has two odd aspects for precisions of zero with integers. First, the zero can be specified in any of these ways, "%4.0d", "%.0d" and "%.d" which was not previously supported here. Secondly, the seemingly universal interpretation of precision for integers is that precision==0 and value==0 means print nothing at all. The code here now handles this for integers just as the code in big/int.c does the same for the Int type. New tests are added to fmt_test.go to verify these changes. R=r, r CC=golang-dev https://golang.org/cl/4717045
-
- 18 Jul, 2011 1 commit
-
-
Rob Pike authored
R=golang-dev, adg CC=golang-dev https://golang.org/cl/4758050
-
- 14 Jul, 2011 1 commit
-
-
Robert Griesemer authored
manual changes in src/pkg/go/printer, src/cmd/gofix/signal_test.go (cd src/cmd/gofix/testdata; gofmt -w *.in *.out) (cd src/pkg/go/printer; gotest -update) gofmt -w misc src runs all tests R=golang-dev, rsc CC=golang-dev https://golang.org/cl/4715041
-
- 28 Jun, 2011 1 commit
-
-
Brad Fitzpatrick authored
The public godoc looked confused. I imagine these were written before current conventions were established. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/4662060
-
- 22 Jun, 2011 1 commit
-
-
Robert Griesemer authored
This is a core API change. 1) gofix misc src 2) Manual adjustments to the following files under src/pkg: gob/decode.go rpc/client.go os/error.go io/io.go bufio/bufio.go http/request.go websocket/client.go as well as: src/cmd/gofix/testdata/*.go.in (reverted) test/fixedbugs/bug243.go 3) Implemented gofix patch (oserrorstring.go) and test case (oserrorstring_test.go) Compiles and runs all tests. R=r, rsc, gri CC=golang-dev https://golang.org/cl/4607052
-
- 20 Jun, 2011 1 commit
-
-
Rob Pike authored
This change causes Print et al. to catch panics generated by calls to String, GoString, and Format. The panic is formatted into the output stream as an error, but the program continues. As a special case, if the argument was a nil pointer, the result is just "<nil>", because that's almost certainly enough information and handles the very common case of String methods that don't guard against nil. Scan does not want this change. Input must work; output can be for debugging and it's nice to get output even when you make a mistake. R=dsymonds, r, adg, gri, rsc, gri CC=golang-dev https://golang.org/cl/4640043
-
- 11 Jun, 2011 1 commit
-
-
Rob Pike authored
%+q uses strconv.Quote[Rune]ToASCII, guaranteeing ASCII-only output. %#U a quoted character if the rune is printable: 'x'=U+0078; otherwise it's as before: U+000A. R=golang-dev, gri, rsc CC=golang-dev https://golang.org/cl/4589047
-
- 25 May, 2011 1 commit
-
-
Rob Pike authored
R=rsc CC=golang-dev https://golang.org/cl/4556060
-