1. 23 Apr, 2019 6 commits
    • Russ Cox's avatar
      encoding/json: document HTML escaping in Compact · d92bc7a5
      Russ Cox authored
      Make explicit that Compact does HTML escaping.
      
      Fixes #30357.
      
      Change-Id: I4648f8f3e907d659db977d07253f716df6e07d7b
      Reviewed-on: https://go-review.googlesource.com/c/go/+/173417
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      d92bc7a5
    • Russ Cox's avatar
      cmd/go: move runtime/debug.modinfo to runtime.modinfo · b51c1570
      Russ Cox authored
      It is easier to ensure that the symbol is always present
      if we move it to package runtime. Avoids init-time work.
      Also moves it next to buildVersion, the other similar symbol.
      
      Setting up for "go version <binary>".
      
      For #31624.
      
      Change-Id: I943724469ce6992153e701257eb6f12da88c8e4e
      Reviewed-on: https://go-review.googlesource.com/c/go/+/173341
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      b51c1570
    • Shubham Sharma's avatar
      net: add IsNotFound field to DNSError · fac3b5d0
      Shubham Sharma authored
      This adds the ability to determine if a lookup error was
      due to a non-existent hostname. Previously users needed
      to do string matching on the DNSError.Err value.
      
      Fixes #28635
      
      Change-Id: If4bd3ad32cbc2db5614f2c6b72e0a9161d813efa
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168597
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      fac3b5d0
    • Daniel Martí's avatar
      encoding/json: index names for the struct decoder · 7e08c7f4
      Daniel Martí authored
      In the common case, structs have a handful of fields and most inputs
      match struct field names exactly.
      
      The previous code would do a linear search over the fields, stopping at
      the first exact match, and otherwise using the first case insensitive
      match.
      
      This is unfortunate, because it means that for the common case, we'd do
      a linear search with bytes.Equal. Even for structs with only two or
      three fields, that is pretty wasteful.
      
      Worse even, up until the exact match was found via the linear search,
      all previous fields would run their equalFold functions, which aren't
      cheap even in the simple case.
      
      Instead, cache a map along with the field list that indexes the fields
      by their name. This way, a case sensitive field search doesn't involve a
      linear search, nor does it involve any equalFold func calls.
      
      This patch should also slightly speed up cases where there's a case
      insensitive match but not a case sensitive one, as then we'd avoid
      calling bytes.Equal on all the fields. Though that's not a common case,
      and there are no benchmarks for it.
      
      name           old time/op    new time/op    delta
      CodeDecoder-8    11.0ms ± 0%    10.6ms ± 1%  -4.42%  (p=0.000 n=9+10)
      
      name           old speed      new speed      delta
      CodeDecoder-8   176MB/s ± 0%   184MB/s ± 1%  +4.62%  (p=0.000 n=9+10)
      
      name           old alloc/op   new alloc/op   delta
      CodeDecoder-8    2.28MB ± 0%    2.28MB ± 0%    ~     (p=0.725 n=10+10)
      
      name           old allocs/op  new allocs/op  delta
      CodeDecoder-8     76.9k ± 0%     76.9k ± 0%    ~     (all equal)
      
      Updates #28923.
      
      Change-Id: I9929c1f06c76505e5b96914199315dbdaae5dc76
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172918
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      7e08c7f4
    • Josh Bleecher Snyder's avatar
      cmd/compile: clean up string/bytes/runes conversion code · 980a57a8
      Josh Bleecher Snyder authored
      Combine the OBYTES2STR and ORUNES2STR cases, as they are identical.
      
      Clean up the construction, commenting, and spacing of the other cases,
      and make them all match.
      
      Passes toolstash-check.
      
      Change-Id: I1be8a528927caeb15e49cb12ca0f11c0827dadd9
      Reviewed-on: https://go-review.googlesource.com/c/go/+/173322
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      980a57a8
    • Russ Cox's avatar
      cmd/go: add env -w and env -u to set and unset default env vars · f0e97546
      Russ Cox authored
      Setting environment variables for go command configuration
      is too difficult and system-specific. This CL adds go env -w,
      to change the default settings more easily, in a portable way.
      It also adds go env -u, to unset those changes.
      
      See https://golang.org/design/30411-env for details.
      
      Fixes #30411.
      
      Change-Id: I36e83f55b666459f8f7f482432a4a6ee015da71d
      Reviewed-on: https://go-review.googlesource.com/c/go/+/171137
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      f0e97546
  2. 22 Apr, 2019 12 commits
  3. 20 Apr, 2019 3 commits
  4. 19 Apr, 2019 19 commits