An error occurred fetching the project authors.
  1. 26 Feb, 2019 1 commit
  2. 07 Oct, 2016 2 commits
    • Russ Cox's avatar
      fmt: document and adjust Scanf space handling to eliminate a few paradoxes · 0db9518a
      Russ Cox authored
      This CL makes minor adjustment to the handling of spaces and newlines
      and then documents the result.
      
      The semantic adjustment mainly concerns the handling of a run of
      spaces following a newline in the format, like in "\n ".
      Previously, that run of spaces was ignored entirely, leading to paradoxes
      like the format "1 \n 2" not matching itself as input.
      Now, spaces following a newline in the format match zero or more
      spaces following the corresponding newline in the input.
      
      The changes to the test suite show how minor the semantic adjustments are
      and how they make the behavior more regular than previously.
      
      This CL also updates the documentation to explain the handling of
      spaces more precisely, incorporating the draft from CL 17723 but
      describing the newly introduced behavior.
      
      Fixes #13565.
      
      Change-Id: I129666e9ba42de3c28b67f75cb47488e9a4c1867
      Reviewed-on: https://go-review.googlesource.com/30611Reviewed-by: default avatarRob Pike <r@golang.org>
      0db9518a
    • Russ Cox's avatar
      fmt: add tests showing current Scanf space handling · 23606c6f
      Russ Cox authored
      There are no semantic changes here, just tests to establish
      the status quo. A followup CL will make some semantic changes,
      the (limited) scope of which should be clear from the number of
      tests that change.
      
      For #13565.
      
      Change-Id: I960749cf59d4dfe39c324875bcc575096654f883
      Reviewed-on: https://go-review.googlesource.com/30610
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      23606c6f
  3. 16 Jul, 2016 1 commit
  4. 21 Mar, 2016 1 commit
  5. 02 Mar, 2016 1 commit
    • Brad Fitzpatrick's avatar
      all: single space after period. · 5fea2ccc
      Brad Fitzpatrick authored
      The tree's pretty inconsistent about single space vs double space
      after a period in documentation. Make it consistently a single space,
      per earlier decisions. This means contributors won't be confused by
      misleading precedence.
      
      This CL doesn't use go/doc to parse. It only addresses // comments.
      It was generated with:
      
      $ perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')
      $ go test go/doc -update
      
      Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7
      Reviewed-on: https://go-review.googlesource.com/20022Reviewed-by: default avatarRob Pike <r@golang.org>
      Reviewed-by: default avatarDave Day <djd@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5fea2ccc
  6. 26 Feb, 2016 1 commit
    • Martin Möhrmann's avatar
      fmt: use public io.RuneScanner interface for ScanState reader · 6520da6e
      Martin Möhrmann authored
      All io.Reader that are passed to newScanState in all the standard
      library tests that implement io.RuneReader also implement io.RuneScanner.
      
      Do not check on each call ScanState's UnreadRune that the used RuneReader
      also implements the UnreadRune method by using a private interface.
      Instead require the used Reader to implement the public RuneScanner
      interface.
      
      The extra implementation logic for UnreadRune is removed from ScanState.
      Instead the readRune wrapper is extended to implement UnreadRune for the
      RuneScanner interface. If the Reader passed to newScanstate does not
      implement RuneScanner the readRune wrapper is used to implement the
      missing functionality.
      
      Note that a RuneReader that does not implement RuneScanner will also
      be wrapped by runeRead which was not the case before.
      Performance with the readRune wrapper is better than without before.
      
      Add benchmark to compare performance with and without using the
      readRune wrapper.
      
      name                             old time/op  new time/op  delta
      ScanInts-2                        704µs ± 0%   615µs ± 1%  -12.73%  (p=0.000 n=20+20)
      ScanRecursiveInt-2               82.6ms ± 0%  51.4ms ± 0%  -37.71%  (p=0.000 n=20+20)
      ScanRecursiveIntReaderWrapper-2  85.1ms ± 0%  52.4ms ± 0%  -38.36%  (p=0.000 n=20+20)
      
      Change-Id: I8c6e85db9b87a8171caab12f020b6e256b498e81
      Reviewed-on: https://go-review.googlesource.com/19895
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      6520da6e
  7. 19 Feb, 2016 1 commit
  8. 11 Dec, 2015 1 commit
  9. 23 Nov, 2015 1 commit
    • Nodir Turakulov's avatar
      fmt: check newline in the end of input · 8331f19d
      Nodir Turakulov authored
      Sscanf doc says:
      Newlines in the input must match newlines in the format.
      
      However Sscanf didn't check newline in the end of input (EOF).
      A test for the case is broken.
      
      * check newline in EOF
      * fix the test
      * slightly simplify ss.doScanf
      
      Fixes #12788
      
      Change-Id: Iaf6b7d81324a72e557543ac22ecea5cecb72e0d6
      Reviewed-on: https://go-review.googlesource.com/16165
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      8331f19d
  10. 20 Nov, 2015 1 commit
  11. 20 Oct, 2015 1 commit
    • Thorben Krueger's avatar
      fmt: Add support for capital '%X' format verb for scanning · 26fe24cb
      Thorben Krueger authored
      For printing, the format verb '%X' results in a capitalized
      hex-representation of the formatted value. Conversely, using
      '%X' in a Scanf function should scan a hex-representation
      into the given interface{}. The existing implementation
      however only supports '%X' for scanning hex values into
      integers; strings or byte slices remain empty. On the other
      hand, lower-case '%x' supports strings and byte slices just
      fine. This is merely an oversight, which this commit fixes.
      (Additional tests also included.)
      
          Fixes #12940
      
      Change-Id: I178a7f615bae950dfc014ca8c0a038448cf0452a
      Reviewed-on: https://go-review.googlesource.com/15689Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      26fe24cb
  12. 24 Aug, 2015 1 commit
  13. 10 Aug, 2015 1 commit
  14. 13 Jun, 2015 1 commit
  15. 12 Jun, 2015 1 commit
    • Rob Pike's avatar
      fmt: require newlines to match when scanning with a format · 57f4b430
      Rob Pike authored
      The documentation says that newlines behave like this:
      
      Scan etc.: newlines are spaces.
      Scanln etc.: newlines terminate the scan.
      Scanf etc.: newlines must match in input and format.
      
      The code did not implement this behavior in all cases,
      especially for Scanf. Make it behave:
      
      - Fix the handling of spaces and newlines in ss.Advance.
      The code is longer but now behaves as it should.
      
      - Delete the reuse of the current ss in newScanState.
      There is really no need, since it's only used in recursive
      calls to Scan etc., and the flags are likely wrong. Simpler
      just to allocate a new one every time, and likelier to
      be correct.
      
      Fixes #10862.
      
      Change-Id: If060ac021017346723b0d62de4e5a305da898f68
      Reviewed-on: https://go-review.googlesource.com/10991Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      57f4b430
  16. 22 Dec, 2014 1 commit
  17. 08 Sep, 2014 1 commit
  18. 15 Aug, 2014 1 commit
  19. 02 Aug, 2013 1 commit
  20. 31 Jul, 2013 1 commit
    • Rob Pike's avatar
      fmt: treat \r\n as \n in Scan · 221af5c1
      Rob Pike authored
      When scanning input and "white space" is permitted, a carriage return
      followed immediately by a newline (\r\n) is treated exactly the same
      as a plain newline (\n). I hope this makes it work better on Windows.
      
      We do it everywhere, not just on Windows, since why not?
      
      Fixes #5391.
      
      R=golang-dev, dsymonds
      CC=golang-dev
      https://golang.org/cl/12142043
      221af5c1
  21. 22 Jan, 2013 1 commit
  22. 11 Jun, 2012 1 commit
  23. 13 Mar, 2012 1 commit
  24. 09 Feb, 2012 1 commit
  25. 09 Dec, 2011 1 commit
  26. 14 Nov, 2011 1 commit
  27. 08 Nov, 2011 1 commit
  28. 02 Nov, 2011 1 commit
  29. 26 Oct, 2011 1 commit
  30. 18 Jul, 2011 1 commit
  31. 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
  32. 02 Jun, 2011 1 commit
  33. 25 Apr, 2011 1 commit
  34. 22 Apr, 2011 1 commit
  35. 08 Apr, 2011 1 commit
  36. 09 Mar, 2011 1 commit
    • Roger Peppe's avatar
      fmt: make ScanState.Token more general. · 3a95587e
      Roger Peppe authored
      When writing custom scanners, I found that
      Token itself was rarely useful, as I did not always
      want to stop at white space. This change makes
      it possible to stop at any class of characters
      while reusing the buffer within State.
      (also fix a bug in Token)
      
      R=r, r2
      CC=golang-dev
      https://golang.org/cl/4243055
      3a95587e
  37. 08 Mar, 2011 1 commit
  38. 06 Mar, 2011 1 commit
  39. 03 Mar, 2011 1 commit
    • Roger Peppe's avatar
      fmt: make recursive scan more efficient. · 5bd284e8
      Roger Peppe authored
      Detect when scan is being called recursively and
      re-use the same scan state.
      
      On my machine, for a recursion-heavy benchmark, this
      results in 44x speed up. This does impose a 4% penalty
      on the non-recursive case, which can be removed by
      heap-allocating the saved state, at 40% performance penalty
      on the recursive case. Either way is fine with me.
      
      R=r
      CC=golang-dev
      https://golang.org/cl/4253049
      5bd284e8