An error occurred fetching the project authors.
  1. 02 Oct, 2014 1 commit
    • Rob Pike's avatar
      fmt: make the %#v verb a special flag · 7c8e057a
      Rob Pike authored
      The %#v verb is special: it says all values below need to print as %#v.
      However, for some situations the # flag has other meanings and this
      causes some issues, particularly in how Formatters work. Since %#v
      dominates all formatting, translate it into actual state of the formatter
      and decouple it from the # flag itself within the calculations (although
      it must be restored when methods are doing the work.)
      The result is cleaner code and correct handling of # for Formatters.
      TODO: Apply the same thinking to the + flag in a followup CL.
      
      Also, the wasString return value in handleMethods is always false,
      so eliminate it.
      
      Update #8835
      
      LGTM=iant
      R=golang-codereviews, iant
      CC=golang-codereviews
      https://golang.org/cl/146650043
      7c8e057a
  2. 01 Oct, 2014 1 commit
    • Rob Pike's avatar
      fmt: fix internal unknownType function · 9f408427
      Rob Pike authored
      This thing should never be called, but before
      151960044 it was being called, incorrectly.
      This is now just a precaution but let's pretend it
      Fixes #8843
      even though that was fixed by 151960044.
      The test case was already there and ran, another mystery.
      
      LGTM=rsc
      R=rsc
      CC=golang-codereviews
      https://golang.org/cl/151970043
      9f408427
  3. 08 Sep, 2014 1 commit
  4. 18 Aug, 2014 1 commit
    • Andrew Gerrand's avatar
      fmt: print byte stringers correctly · 326f48eb
      Andrew Gerrand authored
      type T byte
      func (T) String() string { return "X" }
      
      fmt.Sprintf("%s", []T{97, 98, 99, 100}) == "abcd"
      fmt.Sprintf("%x", []T{97, 98, 99, 100}) == "61626364"
      fmt.Sprintf("%v", []T{97, 98, 99, 100}) == "[X X X X]"
      
      This change makes the last case print correctly.
      Before, it would have been "[97 98 99 100]".
      
      Fixes #8360.
      
      LGTM=r
      R=r, dan.kortschak
      CC=golang-codereviews
      https://golang.org/cl/129330043
      326f48eb
  5. 03 Apr, 2014 1 commit
  6. 19 Mar, 2014 1 commit
    • Rob Pike's avatar
      fmt: make %F a synonym for %f · b00d9677
      Rob Pike authored
      Rationale:
              It already is for scanning.
              It is accepted for complexes already, but doesn't work.
              It's analogous to %G and %E.
              C accepts it too, and we try to be roughly compatible.
      Fixes #7518.
      
      LGTM=bradfitz
      R=golang-codereviews, bradfitz
      CC=golang-codereviews
      https://golang.org/cl/77580044
      b00d9677
  7. 18 Dec, 2013 1 commit
  8. 23 Sep, 2013 1 commit
    • Rob Pike's avatar
      fmt: one bad index shouldn't spoil them all · 3e3ed5d9
      Rob Pike authored
      In an indexed verb such as %[3]d, if the index is out of range, don't
      skip processing the rest of the verbs. The bug was that the bad
      index set a bit for the whole format instead of just the verb.
      
      Ok for 1.2 because this is a bug in a 1.2 feature.
      
      Fixes #6434
      
      R=golang-dev, adg
      CC=golang-dev
      https://golang.org/cl/13632058
      3e3ed5d9
  9. 15 Sep, 2013 1 commit
  10. 28 Aug, 2013 1 commit
  11. 02 Aug, 2013 1 commit
  12. 31 Jul, 2013 2 commits
  13. 23 Jul, 2013 1 commit
    • Rob Pike's avatar
      all: be more idiomatic when documenting boolean return values. · abe384f6
      Rob Pike authored
      Phrases like "returns whether or not the image is opaque" could be
      describing what the function does (it always returns, regardless of
      the opacity) or what it returns (a boolean indicating the opacity).
      Even when the "or not" is missing, the phrasing is bizarre.
      
      Go with "reports whether", which is still clunky but at least makes
      it clear we're talking about the return value.
      
      These were edited by hand. A few were cleaned up in other ways.
      
      R=golang-dev, dsymonds
      CC=golang-dev
      https://golang.org/cl/11699043
      abe384f6
  14. 20 Jun, 2013 1 commit
  15. 29 May, 2013 1 commit
  16. 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
  17. 29 Apr, 2013 1 commit
  18. 10 Apr, 2013 1 commit
  19. 20 Feb, 2013 1 commit
  20. 31 Jan, 2013 1 commit
  21. 22 Jan, 2013 1 commit
  22. 25 Dec, 2012 1 commit
  23. 30 Oct, 2012 1 commit
  24. 26 Sep, 2012 1 commit
  25. 17 Aug, 2012 1 commit
  26. 25 Jun, 2012 1 commit
  27. 06 Jun, 2012 1 commit
  28. 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
  29. 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
  30. 08 Feb, 2012 1 commit
  31. 15 Dec, 2011 2 commits
  32. 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
  33. 23 Nov, 2011 1 commit
  34. 14 Nov, 2011 1 commit
  35. 08 Nov, 2011 1 commit
  36. 02 Nov, 2011 2 commits
  37. 28 Oct, 2011 1 commit