1. 23 May, 2019 8 commits
    • Caleb Spare's avatar
      strconv: fix rounding in FormatFloat fallback path · 05092163
      Caleb Spare authored
      Float formatting uses a multiprecision fallback path where Grisu3
      algorithm fails. This has a bug during the rounding phase: the
      difference between the decimal value and the upper bound is examined
      byte-by-byte and doesn't properly handle the case where the first
      divergence has a difference of 1.
      
      For instance (using an example from #29491), for the number
      498484681984085570, roundShortest examines the three decimal values:
      
      lower: 498484681984085536
      d:     498484681984085568
      upper: 498484681984085600
      
      After examining the 16th digit, we know that rounding d up will fall
      within the bounds unless all remaining digits of d are 9 and all
      remaining digits of upper are 0:
      
      d:     ...855xx
      upper: ...856xx
      
      However, the loop forgets that d and upper have already diverged and
      then on the next iteration sees that the 17th digit of d is actually
      lower than the 17th digit of upper and decides that we still can't round
      up:
      
      d:     ...8556x
      upper: ...8560x
      
      Thus the original value is incorrectly rounded down to
      498484681984085560 instead of the closer (and equally short)
      498484681984085570.
      
      Thanks to Brian Kessler for diagnosing this bug.
      
      Fix it by remembering when we've seen divergence in previous digits.
      
      This CL also fixes another bug in the same loop: for some inputs, the
      decimal value d or the lower bound may have fewer digits than the upper
      bound, yet the iteration through the digits starts at i=0 for each of
      them. For instance, given the float64 value 1e23, we have
      
      d:      99999999999999991611392
      upper: 100000000000000000000000
      
      but the loop starts by comparing '9' to '1' rather than '0' to '1'.
      
      I haven't found any cases where this second bug causes incorrect output
      because when the digit comparison fails on the first loop iteration the
      upper bound always has more nonzero digits (i.e., the expression
      'i+1 < upper.nd' is always true).
      
      Fixes #29491
      
      Change-Id: I58856a7a2e47935ec2f233d9f717ef15c78bb2d0
      Reviewed-on: https://go-review.googlesource.com/c/go/+/157697
      Run-TryBot: Caleb Spare <cespare@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRémy Oudompheng <remyoudompheng@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      05092163
    • Russ Cox's avatar
      cmd/go: default to GOPROXY=https://proxy.golang.org and GOSUMDB=sum.golang.org · f8a5ba2a
      Russ Cox authored
      This CL changes the default module download and module verification mechanisms
      to use the Go module mirror and Go checksum database run by Google.
      See https://proxy.golang.org/privacy for the services' privacy policy.
      (Today, that URL is a redirect to Google's standard privacy policy,
      which covers these services as well. If we publish a more specific
      privacy policy just for these services, that URL will be updated to
      display or redirect to it.)
      
      See 'go help modules' and 'go help modules-auth' for details (added in this CL).
      
      To disable the mirror and checksum database for non-public modules:
      
      	go env -w GONOPROXY=*.private.net,your.com/*
      	go env -w GONOSUMDB=*.private.net,your.com/*
      
      (If you are using a private module proxy then you'd only do the second.)
      
      If you run into problems with the behavior of the go command when using
      the Go module mirror or the Go checksum database, please file issues at
      https://golang.org/issue/new, so that we can address them for the
      Go 1.13 release.
      
      For #25530.
      
      This CL also documents GONOPROXY.
      Fixes #32056.
      
      Change-Id: I2fde82e071742272b0842efd9580df1a56947fec
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178179
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      f8a5ba2a
    • Mickey Reiss's avatar
      bufio: Fix typo in scan.go documentation · 4fbb4e74
      Mickey Reiss authored
      Apologies for the the nitpicky PR. I believe there is a minor typo in the documentation of `MaxScanTokenSize`, which confused me for a moment when I went to search for the referenced method, `Scan.Buffer`. Thanks!
      
      Change-Id: I5d21e77276285206497fe75291001032c255cace
      GitHub-Last-Rev: 635e35c0191c11f2b6966b5e58cf91a1064099da
      GitHub-Pull-Request: golang/go#32193
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178637Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      4fbb4e74
    • Agniva De Sarker's avatar
      cmd/doc: stop showing interface methods while matching symbols · 65ef999d
      Agniva De Sarker authored
      Fixes #31961
      
      Change-Id: I9db9ecfd2f8ca7cf51df4413a6e0d66de5da7043
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178457
      Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      65ef999d
    • Ariel Mashraki's avatar
      text/template: add a slice function to the predefined global functions · e2970a45
      Ariel Mashraki authored
      The new slice function returns the result of slicing its first argument by
      the following arguments. Thus {{slice x 1 3}} is, in Go syntax, x[1:3].
      Each sliced item must be a string, slice, or array.
      
      Closed #30153
      
      RELNOTE=yes
      
      Change-Id: I63188c422848cee3d383a64dc4d046e3a1767c63
      Reviewed-on: https://go-review.googlesource.com/c/go/+/161762Reviewed-by: default avatarRob Pike <r@golang.org>
      e2970a45
    • Martin Möhrmann's avatar
      fmt: always clear wrapErrs · 6f51082d
      Martin Möhrmann authored
      Like panicking and erroring - wrapErrs should always be reset to
      the default false. wrapErrs should only be true when set by Errorf.
      
      Change-Id: I4d51cc2f0905109e232b0983dc5331bd34f138bc
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178517
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDamien Neil <dneil@google.com>
      6f51082d
    • LE Manh Cuong's avatar
      test/fixedbugs: fix some tests will not be run · 3e9d8e2e
      LE Manh Cuong authored
      Currently, some tests under test/fixedbugs never run:
      
      	$ for d in test/fixedbugs/*.dir; do
      	  ! test -f "${d%.dir}.go" && echo "$d"
      	done
      	test/fixedbugs/issue15071.dir
      	test/fixedbugs/issue15609.dir
      	test/fixedbugs/issue29612.dir
      
      Because they missed the corresponding ".go" file, so "go run run.go"
      will skip them.
      
      Add missing ".go" files for those tests to make sure they will be
      collected and run.
      
      While at it, add another action "runindir", which does "go run ."
      inside the t.goDirName then check the output.
      
      Change-Id: I88000b3663a6a615d90c1cf11844ea0377403e3d
      Reviewed-on: https://go-review.googlesource.com/c/go/+/177798
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      3e9d8e2e
    • Brad Fitzpatrick's avatar
      cmd/dist: support using cross-compiled std test binaries for slow builders · 7a567a63
      Brad Fitzpatrick authored
      We want the builders to be able to cross-compile test binaries for a
      few of the super slow builders that require either slow hardware or
      slow full CPU emulation.
      
      Updates golang/go#31217
      
      Change-Id: I8d33b18efaf788f6f131354b2917ac9738ca975e
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178399
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      7a567a63
  2. 22 May, 2019 12 commits
  3. 21 May, 2019 10 commits
  4. 20 May, 2019 10 commits