1. 23 May, 2019 11 commits
    • Michael McLoughlin's avatar
      crypto/sha*: replace putUint{32,64} helpers · 3ce865d7
      Michael McLoughlin authored
      Replaces putUint{32,64} functions in crypto/sha* packages with the
      equivalent functions encoding/binary.BigEndian.PutUint{32,64}.
      
      Change-Id: I9208d2125202ea9c97777560e6917d21893aced0
      Reviewed-on: https://go-review.googlesource.com/c/go/+/156117Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      3ce865d7
    • Leon Klingele's avatar
      image: add missing error check in test · 2500ac20
      Leon Klingele authored
      Change-Id: Ia42a4a658e4207cc1f036f2faeac011e71edad77
      GitHub-Last-Rev: b384f81799fcd404f53647d8a3015487ea240c6f
      GitHub-Pull-Request: golang/go#30012
      Reviewed-on: https://go-review.googlesource.com/c/go/+/160436
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      2500ac20
    • andrius4669's avatar
      mime: encode CTL and non-US-ASCII characters in FormatMediaType · 0ac4ea79
      andrius4669 authored
      Encodes non-WSP CTL and non-US-ASCII UTF-8 characters using syntax specified in RFC 2231.
      
      Fixes #7668
      Fixes #9624
      
      Change-Id: I433f167c5bdd84a7f811ac0410b08b10790e0d9f
      GitHub-Last-Rev: 9c77146760341fdb3af35c1b94d4ee00ffb0daae
      GitHub-Pull-Request: golang/go#29328
      Reviewed-on: https://go-review.googlesource.com/c/go/+/154760Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      0ac4ea79
    • 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 7 commits
    • Jay Conrod's avatar
      cmd/go: make 'go get -t' consider test dependencies in module mode · ab724d43
      Jay Conrod authored
      Fixes #32037
      
      Change-Id: I696fe2029e383746252f37fe8d30df71b5ac8a6c
      Reviewed-on: https://go-review.googlesource.com/c/go/+/177677
      Run-TryBot: Jay Conrod <jayconrod@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      ab724d43
    • adarsh ravichandran's avatar
      math/bits: add example for OnesCount function · 776e1709
      adarsh ravichandran authored
      Change-Id: Id87db9bed5e8715d554c1bf95c063d7d0a03c3e9
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178117
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      776e1709
    • Keith Randall's avatar
      runtime: In Frames.Next, delay file/line lookup until just before return · c77a9e0a
      Keith Randall authored
      That way we will never have to look up the file/line for the frame
      that's next to be returned when the user stops calling Next.
      
      For the benchmark from #32093:
      
      name      old time/op  new time/op  delta
      Helper-4   948ns ± 1%   836ns ± 3%  -11.89%  (p=0.000 n=9+9)
      
      (#32093 was fixed with a more specific, and better, fix, but this
      fix is much more general.)
      
      Change-Id: I89e796f80c9706706d8d8b30eb14be3a8a442846
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178077
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c77a9e0a
    • Michael Anthony Knyszek's avatar
      runtime: overhaul TestPhysicalMemoryUtilization · 5a903063
      Michael Anthony Knyszek authored
      Currently, this test allocates many objects and relies on heap-growth
      scavenging to happen unconditionally on heap-growth. However with the
      new pacing system for the scavenging, this is no longer true and the
      test is flaky.
      
      So, this change overhauls TestPhysicalMemoryUtilization to check the
      same aspect of the runtime, but in a much more robust way.
      
      Firstly, it sets up a much more constrained scenario: only 5 objects are
      allocated total with a maximum worst-case (i.e. the test fails) memory
      footprint of about 16 MiB. The test is now aware that scavenging will
      only happen if the heap growth causes us to push way past our scavenge
      goal, which is based on the heap goal. So, it makes the holes in the
      test much bigger and the actual retained allocations much smaller to
      keep the heap goal at the heap's minimum size. It does this twice to
      create exactly two unscavenged holes. Because the ratio between the size
      of the "saved" objects and the "condemned" object is so small, two holes
      are sufficient to create a consistent test.
      
      Then, the test allocates one enormous object (the size of the 4 other
      objects allocated, combined) with the intent that heap-growth scavenging
      should kick in and scavenge the holes. The heap goal will rise after
      this object is allocated, so it's very important we do all the
      scavenging in a single allocation that exceeds the heap goal because
      otherwise the rising heap goal could foil our test.
      
      Finally, we check memory use relative to HeapAlloc as before. Since the
      runtime should scavenge the entirety of the remaining holes,
      theoretically there should be no more free and unscavenged memory.
      However due to other allocations that may happen during the test we may
      still see unscavenged memory, so we need to have some threshold. We keep
      the current 10% threshold which, while arbitrary, is very conservative
      and should easily account for any other allocations the test makes.
      
      Before, we also had to ensure the allocations we were making looked
      large relative to the size of a heap arena since newly-mapped memory was
      considered unscavenged, and so that could significantly skew the test.
      However, thanks to the fix for #32012 we were able to reduce memory use
      to 16 MiB in the worst case.
      
      Fixes #32010.
      
      Change-Id: Ia38130481e292f581da7fa3289c98c99dc5394ed
      Reviewed-on: https://go-review.googlesource.com/c/go/+/177237Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      5a903063
    • Alex Myasoedov's avatar
      context: document CancelFunc to be safe for simultaneous use by multiple goroutines · 82ee4e7f
      Alex Myasoedov authored
      Fixes #32145
      
      Change-Id: If4c9dd3a2af748974141ad6e571f80efcbaad772
      Reviewed-on: https://go-review.googlesource.com/c/go/+/177899Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      82ee4e7f
    • Shulhan's avatar
      internal/envcmd: print GO111MODULE when executing "go env" · 295c5662
      Shulhan authored
      If we look at the issues in the past releases that are related
      to go command that involved modules, its usually mention or ask about
      the value of GO111MODULE, either in separate line or in separate
      comment.
      
      There are quite long time range before GO111MODULE will be removed
      (unused).  The next release is still default to auto [1], and until Go
      1.13 unsupported (two releases after that) there is about one and half
      years after that.
      
      Since the change is not that big (one line) [2], maybe temporary adding
      it to "go env" give more clarity and benefit in issue reporting rather
      than not.
      
      [1] https://github.com/golang/go/issues/31857
      
      Fixes #29656
      
      Change-Id: I609ad6664774018e4f4147ec6158485172968e16
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176837
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      295c5662
    • LE Manh Cuong's avatar
      cmd/compile: use internal/race · 4ee4607c
      LE Manh Cuong authored
      CL 14870 added internal/race to factor out duplicated race thunks,
      we should use it.
      
      No signification changes in compile time and compile binary size.
      
      Change-Id: I786af44dd5bb0f4ab6709432eeb603f27a5b6c63
      Reviewed-on: https://go-review.googlesource.com/c/go/+/178118
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      4ee4607c