An error occurred fetching the project authors.
  1. 29 May, 2013 1 commit
  2. 24 May, 2013 1 commit
    • Rob Pike's avatar
      fmt.Printf: introduce notation for random access to arguments. · 7472ce0e
      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
      7472ce0e
  3. 29 Apr, 2013 1 commit
  4. 10 Apr, 2013 1 commit
  5. 20 Feb, 2013 1 commit
  6. 31 Jan, 2013 1 commit
  7. 22 Jan, 2013 1 commit
  8. 25 Dec, 2012 1 commit
  9. 30 Oct, 2012 1 commit
  10. 26 Sep, 2012 1 commit
  11. 17 Aug, 2012 1 commit
  12. 25 Jun, 2012 1 commit
  13. 06 Jun, 2012 1 commit
  14. 29 May, 2012 1 commit
    • Rob Pike's avatar
      fmt: speed up 10-20% · 53bc1944
      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
      53bc1944
  15. 07 Mar, 2012 1 commit
    • Russ Cox's avatar
      fmt, log: stop using unicode · 0bc18811
      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
      0bc18811
  16. 08 Feb, 2012 1 commit
  17. 15 Dec, 2011 2 commits
  18. 06 Dec, 2011 1 commit
    • Rob Pike's avatar
      fmt: only use Stringer or Error for strings · 2ed57a8c
      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
      2ed57a8c
  19. 23 Nov, 2011 1 commit
  20. 14 Nov, 2011 1 commit
  21. 08 Nov, 2011 1 commit
  22. 02 Nov, 2011 2 commits
  23. 28 Oct, 2011 1 commit
  24. 26 Oct, 2011 1 commit
  25. 21 Oct, 2011 1 commit
  26. 19 Oct, 2011 1 commit
  27. 18 Oct, 2011 1 commit
  28. 17 Oct, 2011 1 commit
  29. 12 Oct, 2011 1 commit
  30. 29 Sep, 2011 1 commit
    • Rob Pike's avatar
      fmt: replace channel cache with slice. · 12ad9b43
      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
      12ad9b43
  31. 21 Jul, 2011 1 commit
    • Michael T. Jones's avatar
      fmt: handle precision 0 format stings in standard way · 8cdee891
      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
      8cdee891
  32. 18 Jul, 2011 1 commit
  33. 14 Jul, 2011 1 commit
  34. 28 Jun, 2011 1 commit
  35. 22 Jun, 2011 1 commit
    • Robert Griesemer's avatar
      os.Error API: don't export os.ErrorString, use os.NewError consistently · 712fb6dc
      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
      712fb6dc
  36. 20 Jun, 2011 1 commit
    • Rob Pike's avatar
      fmt: catch panics from calls to String etc. · 97a929aa
      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
      97a929aa
  37. 11 Jun, 2011 1 commit
  38. 25 May, 2011 1 commit