1. 26 Feb, 2019 40 commits
    • Derek Phan's avatar
      io: align style of test comments in multi_test.go · 337662f7
      Derek Phan authored
      Change-Id: Ic93a084311de46461ed3b30f4ac2fe11311e74d7
      GitHub-Last-Rev: 32fbd63b10d0fa489406333ff6f8b6708974a73c
      GitHub-Pull-Request: golang/go#29705
      Reviewed-on: https://go-review.googlesource.com/c/157642
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatt Layher <mdlayher@gmail.com>
      337662f7
    • Alessandro Arzilli's avatar
      cmd/compile: avoid collisions between statictmps and user vars · 08831b15
      Alessandro Arzilli authored
      Avoid name collisions between autogenerated statictmp variables and
      user defined global variables.
      
      Fixes #25113
      
      Change-Id: I023eb42a5c2bd2f5352b046d33363faed87084dc
      Reviewed-on: https://go-review.googlesource.com/c/142497Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      08831b15
    • Austin Clements's avatar
      cmd/link: delete stale deadcode reference · 2cdebb51
      Austin Clements authored
      Back when the linker did code generation after dead code elimination,
      it had to know that references to runtime.read_tls_fallback could be
      generated at code generation time (and never appear before that). Now
      that code generation is done by the compiler, the references to
      runtime.read_tls_fallback are obvious in the relocations, so the
      linker no longer needs special knowledge of this symbol.
      
      Change-Id: I9813a8478e85a6a13470b2d0528db53fd33fcfdf
      Reviewed-on: https://go-review.googlesource.com/c/154601
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      2cdebb51
    • Marcel van Lohuizen's avatar
      bytes: hoist error creation out of function · ef954a03
      Marcel van Lohuizen authored
      generating frame information in errors will cause this
      function to no longer be inlined.
      
      Updates #29934.
      
      Change-Id: I1d7bc11707f1872d7315f627bfb9a12afa41e358
      Reviewed-on: https://go-review.googlesource.com/c/161760
      Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      ef954a03
    • Tobias Klauser's avatar
      runtime: use hw.ncpuonline sysctl in getncpu on openbsd · c55eeeb7
      Tobias Klauser authored
      The number of CPUs reported by the hw.ncpu sysctl is twice as high as
      the actual number of CPUs running on OpenBSD 6.4. with hyperthreading
      disabled (hw.smt=0). Try hw.cpuonline first and fall back to hw.ncpu
      in case it fails (which is the case on older OpenBSD before 6.4).
      
      Fixes #30127
      
      Change-Id: Id091234b8038cc9f7c40519d039fc1a05437c40d
      Reviewed-on: https://go-review.googlesource.com/c/161757
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      c55eeeb7
    • Ggicci's avatar
      net/http: clean the path of the stripped URL by StripPrefix · ea65d015
      Ggicci authored
      The path of the new stripped URL should also be cleaned. Since an empty path
      may cause unexpected errors in some HTTP handlers, e.g. http.ServeFile.
      
      Fixes #30165
      
      Change-Id: Ib44fdce6388b5d62ffbcab5266925ef8f13f26e2
      Reviewed-on: https://go-review.googlesource.com/c/161738Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ea65d015
    • Yasser Abdolmaleki's avatar
      crypto/tls: fix typo · 5a7e8f46
      Yasser Abdolmaleki authored
      Change-Id: If9332bae87449c94fc14710133614fcd84d2815c
      Reviewed-on: https://go-review.googlesource.com/c/161726Reviewed-by: default avatarFilippo Valsorda <filippo@golang.org>
      5a7e8f46
    • Tobias Klauser's avatar
      syscall: add empty line before marker comments in zsyscall_darwin_*.go · 38a4b379
      Tobias Klauser authored
      This was spotted during the review of the corresponding CL 154179 for
      x/sys/unix. Let's change it in syscall as well to be consistent.
      
      Change-Id: I33f25db1f6ba941b694c2aa276336448cc2b9b51
      Reviewed-on: https://go-review.googlesource.com/c/154719
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      38a4b379
    • Tooru Takahashi's avatar
      cmd/internal/src: fix typo in pos.go · 8d057f3a
      Tooru Takahashi authored
      Change-Id: I31ac8845e72c3027c9a463b1f691f4d2b7913ec0
      GitHub-Last-Rev: a6b185cc41d649141e6034b77bcfe53525498ea6
      GitHub-Pull-Request: golang/go#29682
      Reviewed-on: https://go-review.googlesource.com/c/157518Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      8d057f3a
    • Keith Randall's avatar
      cmd/compile: don't bother compiling functions named "_" · f495f549
      Keith Randall authored
      They can't be used, so we don't need code generated for them. We just
      need to report errors in their bodies.
      
      The compiler currently has a bunch of special cases sprinkled about
      for "_" functions, because we never generate a linker symbol for them.
      Instead, abort compilation earlier so we never reach any of that
      special-case code.
      
      Fixes #29870
      
      Change-Id: I3530c9c353deabcf75ce9072c0b740e992349ee5
      Reviewed-on: https://go-review.googlesource.com/c/158845
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      f495f549
    • Keith Randall's avatar
      cmd/compile: treat slice pointers as non-nil · 933e34ac
      Keith Randall authored
      var a []int = ...
      p := &a[0]
      _ = *p
      
      We don't need to nil check on the 3rd line. If the bounds check on the 2nd
      line passes, we know p is non-nil.
      
      We rely on the fact that any cap>0 slice has a non-nil pointer as its
      pointer to the backing array. This is true for all safely-constructed slices,
      and I don't see any reason why someone would violate this rule using unsafe.
      
      R=go1.13
      
      Fixes #30366
      
      Change-Id: I3ed764fcb72cfe1fbf963d8c1a82e24e3b6dead7
      Reviewed-on: https://go-review.googlesource.com/c/163740
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      933e34ac
    • Keith Randall's avatar
      cmd/compile: update comment about x86 nop instruction generator · 57976fe2
      Keith Randall authored
      The comment about losing the high bits is incorrect.  We now use these
      nops in places where they really need to be a nop.  (Before inline
      marks, we used them just before deferreturn calls, so they could
      clobber any caller-saved values.)
      
      Change-Id: I433d1ec455aa37dab8fef6eb7d407f3737dbb97f
      Reviewed-on: https://go-review.googlesource.com/c/158057Reviewed-by: default avatarIlya Tocar <ilya.tocar@intel.com>
      57976fe2
    • Alex Brainman's avatar
      runtime: fix syscall.NewCallback to return all bits for uintptr values · 5cf4e442
      Alex Brainman authored
      syscall.NewCallback mistakenly used MOVL even for windows/amd64,
      which only returned the lower 32 bits regardless of the architecture.
      This was due to a copy and paste after porting from windows/386.
      The code now uses MOVQ, which will return all the available bits.
      
      Also adjust TestReturnAfterStackGrowInCallback to ensure we never
      regress.
      
      Fixes #29331
      
      Change-Id: I4f5c8021c33f234c2bb7baa9ef7a6b4870172509
      Reviewed-on: https://go-review.googlesource.com/c/159579
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      5cf4e442
    • Josh Bleecher Snyder's avatar
      html/template: use strings.Builder · c97e5765
      Josh Bleecher Snyder authored
      ...and size initial buffers more accurately.
      
      Easy pickings only. More might remain.
      
      name                             old time/op    new time/op    delta
      CSSEscaper-8                       1.17µs ± 1%    0.80µs ± 2%  -31.55%  (p=0.000 n=44+48)
      CSSEscaperNoSpecials-8              205ns ± 2%     204ns ± 3%   -0.73%  (p=0.014 n=46+49)
      DecodeCSS-8                         438ns ± 2%     436ns ± 2%     ~     (p=0.099 n=48+47)
      DecodeCSSNoSpecials-8              6.11ns ± 3%    5.93ns ± 3%   -2.85%  (p=0.000 n=50+48)
      CSSValueFilter-8                    149ns ± 0%     145ns ± 0%   -2.68%  (p=0.000 n=32+35)
      CSSValueFilterOk-8                  238ns ± 2%     234ns ± 2%   -1.40%  (p=0.000 n=49+47)
      EscapedExecute-8                   2.53µs ± 2%    2.55µs ± 1%   +0.87%  (p=0.000 n=48+49)
      HTMLNospaceEscaper-8               1.35µs ± 2%    0.92µs ± 1%  -31.74%  (p=0.000 n=48+48)
      HTMLNospaceEscaperNoSpecials-8      278ns ± 2%     263ns ± 2%   -5.17%  (p=0.000 n=47+49)
      StripTags-8                         778ns ± 2%     786ns ± 1%   +0.96%  (p=0.000 n=46+47)
      StripTagsNoSpecials-8              84.2ns ± 1%    84.1ns ± 1%     ~     (p=0.300 n=48+48)
      JSValEscaperWithNum-8               506ns ± 2%     486ns ± 3%   -3.82%  (p=0.000 n=47+45)
      JSValEscaperWithStr-8              1.61µs ± 1%    1.64µs ± 1%   +1.75%  (p=0.000 n=44+49)
      JSValEscaperWithStrNoSpecials-8     548ns ± 2%     552ns ± 2%   +0.78%  (p=0.000 n=48+46)
      JSValEscaperWithObj-8              1.91µs ± 2%    1.87µs ± 1%   -2.08%  (p=0.000 n=49+47)
      JSValEscaperWithObjNoSpecials-8     735ns ± 2%     742ns ± 2%   +1.01%  (p=0.000 n=47+49)
      JSStrEscaperNoSpecials-8            228ns ± 4%     211ns ± 3%   -7.53%  (p=0.000 n=50+49)
      JSStrEscaper-8                     1.11µs ± 1%    0.78µs ± 1%  -29.94%  (p=0.000 n=48+48)
      JSRegexpEscaperNoSpecials-8         214ns ± 2%     212ns ± 3%   -1.12%  (p=0.000 n=50+49)
      JSRegexpEscaper-8                  1.17µs ± 0%    0.79µs ± 1%  -31.92%  (p=0.000 n=48+47)
      TemplateSpecialTags-8               172µs ± 1%     172µs ± 1%     ~     (p=0.976 n=48+47)
      URLEscaper-8                       1.88µs ± 2%    1.87µs ± 2%   -0.56%  (p=0.001 n=49+49)
      URLEscaperNoSpecials-8              162ns ± 1%     169ns ± 1%   +3.76%  (p=0.000 n=49+50)
      URLNormalizer-8                    1.29µs ± 3%    1.29µs ± 2%   -0.37%  (p=0.041 n=48+48)
      URLNormalizerNoSpecials-8           185ns ± 1%     186ns ± 1%   +0.15%  (p=0.013 n=49+49)
      SrcsetFilter-8                      616ns ± 1%     618ns ± 1%   +0.36%  (p=0.000 n=46+46)
      SrcsetFilterNoSpecials-8            359ns ± 0%     352ns ± 0%   -1.93%  (p=0.000 n=40+43)
      [Geo mean]                          560ns          525ns        -6.17%
      
      name                             old alloc/op   new alloc/op   delta
      CSSEscaper-8                         672B ± 0%      336B ± 0%  -50.00%  (p=0.000 n=50+50)
      CSSEscaperNoSpecials-8              0.00B          0.00B          ~     (all equal)
      DecodeCSS-8                          160B ± 0%      160B ± 0%     ~     (all equal)
      DecodeCSSNoSpecials-8               0.00B          0.00B          ~     (all equal)
      CSSValueFilter-8                    96.0B ± 0%     96.0B ± 0%     ~     (all equal)
      CSSValueFilterOk-8                  48.0B ± 0%     48.0B ± 0%     ~     (all equal)
      EscapedExecute-8                     688B ± 0%      624B ± 0%   -9.30%  (p=0.000 n=50+50)
      HTMLNospaceEscaper-8                 752B ± 0%      368B ± 0%  -51.06%  (p=0.000 n=50+50)
      HTMLNospaceEscaperNoSpecials-8      48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=50+50)
      StripTags-8                          224B ± 0%      224B ± 0%     ~     (all equal)
      StripTagsNoSpecials-8                112B ± 0%      112B ± 0%     ~     (all equal)
      JSValEscaperWithNum-8               96.0B ± 0%     40.0B ± 0%  -58.33%  (p=0.000 n=50+50)
      JSValEscaperWithStr-8                384B ± 0%      384B ± 0%     ~     (all equal)
      JSValEscaperWithStrNoSpecials-8     96.0B ± 0%     96.0B ± 0%     ~     (all equal)
      JSValEscaperWithObj-8                448B ± 0%      448B ± 0%     ~     (all equal)
      JSValEscaperWithObjNoSpecials-8      160B ± 0%      160B ± 0%     ~     (all equal)
      JSStrEscaperNoSpecials-8            0.00B          0.00B          ~     (all equal)
      JSStrEscaper-8                       672B ± 0%      336B ± 0%  -50.00%  (p=0.000 n=50+50)
      JSRegexpEscaperNoSpecials-8         0.00B          0.00B          ~     (all equal)
      JSRegexpEscaper-8                    672B ± 0%      336B ± 0%  -50.00%  (p=0.000 n=50+50)
      TemplateSpecialTags-8              48.0kB ± 0%    47.9kB ± 0%   -0.13%  (p=0.000 n=50+48)
      URLEscaper-8                         336B ± 0%      336B ± 0%     ~     (all equal)
      URLEscaperNoSpecials-8               112B ± 0%      112B ± 0%     ~     (all equal)
      URLNormalizer-8                      176B ± 0%      176B ± 0%     ~     (all equal)
      URLNormalizerNoSpecials-8            112B ± 0%      112B ± 0%     ~     (all equal)
      SrcsetFilter-8                       160B ± 0%      160B ± 0%     ~     (all equal)
      SrcsetFilterNoSpecials-8             160B ± 0%      160B ± 0%     ~     (all equal)
      [Geo mean]                           259B           216B       -16.60%
      
      name                             old allocs/op  new allocs/op  delta
      CSSEscaper-8                         4.00 ± 0%      2.00 ± 0%  -50.00%  (p=0.000 n=50+50)
      CSSEscaperNoSpecials-8               0.00           0.00          ~     (all equal)
      DecodeCSS-8                          1.00 ± 0%      1.00 ± 0%     ~     (all equal)
      DecodeCSSNoSpecials-8                0.00           0.00          ~     (all equal)
      CSSValueFilter-8                     2.00 ± 0%      2.00 ± 0%     ~     (all equal)
      CSSValueFilterOk-8                   3.00 ± 0%      3.00 ± 0%     ~     (all equal)
      EscapedExecute-8                     18.0 ± 0%      18.0 ± 0%     ~     (all equal)
      HTMLNospaceEscaper-8                 5.00 ± 0%      3.00 ± 0%  -40.00%  (p=0.000 n=50+50)
      HTMLNospaceEscaperNoSpecials-8       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
      StripTags-8                          3.00 ± 0%      3.00 ± 0%     ~     (all equal)
      StripTagsNoSpecials-8                2.00 ± 0%      2.00 ± 0%     ~     (all equal)
      JSValEscaperWithNum-8                3.00 ± 0%      3.00 ± 0%     ~     (all equal)
      JSValEscaperWithStr-8                2.00 ± 0%      2.00 ± 0%     ~     (all equal)
      JSValEscaperWithStrNoSpecials-8      2.00 ± 0%      2.00 ± 0%     ~     (all equal)
      JSValEscaperWithObj-8                3.00 ± 0%      3.00 ± 0%     ~     (all equal)
      JSValEscaperWithObjNoSpecials-8      3.00 ± 0%      3.00 ± 0%     ~     (all equal)
      JSStrEscaperNoSpecials-8             0.00           0.00          ~     (all equal)
      JSStrEscaper-8                       4.00 ± 0%      2.00 ± 0%  -50.00%  (p=0.000 n=50+50)
      JSRegexpEscaperNoSpecials-8          0.00           0.00          ~     (all equal)
      JSRegexpEscaper-8                    4.00 ± 0%      2.00 ± 0%  -50.00%  (p=0.000 n=50+50)
      TemplateSpecialTags-8                 185 ± 0%       185 ± 0%     ~     (all equal)
      URLEscaper-8                         4.00 ± 0%      4.00 ± 0%     ~     (all equal)
      URLEscaperNoSpecials-8               2.00 ± 0%      2.00 ± 0%     ~     (all equal)
      URLNormalizer-8                      3.00 ± 0%      3.00 ± 0%     ~     (all equal)
      URLNormalizerNoSpecials-8            2.00 ± 0%      2.00 ± 0%     ~     (all equal)
      SrcsetFilter-8                       3.00 ± 0%      3.00 ± 0%     ~     (all equal)
      SrcsetFilterNoSpecials-8             3.00 ± 0%      3.00 ± 0%     ~     (all equal)
      [Geo mean]                           3.41           3.05       -10.65%
      
      Change-Id: I809ea56495ce1881656af7e24621448ab64b449a
      Reviewed-on: https://go-review.googlesource.com/c/155919
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c97e5765
    • Josh Bleecher Snyder's avatar
      cmd/compile: remove badgerbadgerbadger optimization · c63dc6d4
      Josh Bleecher Snyder authored
      As discussed in #29242, this optimization is for a bash-ism.
      No one writes Go code like this.
      
      In this repo, it triggers only in test/fixedbugs/bug425.go
      and that appears to be accidental.
      
      Fixes #29242
      
      Change-Id: I257e6ecc73f24680f7282c6ab28729de4e8b27af
      Reviewed-on: https://go-review.googlesource.com/c/163728
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c63dc6d4
    • Russ Cox's avatar
      math/big: add %#b and %O integer formats · d6311ff1
      Russ Cox authored
      Matching fmt, %#b now prints an 0b prefix,
      and %O prints octal with an 0o prefix.
      
      See golang.org/design/19308-number-literals for background.
      
      For #19308.
      For #12711.
      
      Change-Id: I139c5a9a1dfae15415621601edfa13c6a5f19cfc
      Reviewed-on: https://go-review.googlesource.com/c/160250Reviewed-by: default avatarRob Pike <r@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      d6311ff1
    • Russ Cox's avatar
      math/big: add %x float format · 675503c5
      Russ Cox authored
      big.Float already had %p for printing hex format,
      but that format normalizes differently from fmt's %x
      and ignores precision entirely.
      
      This CL adds %x to big.Float, matching fmt's behavior:
      the verb is spelled 'x' not 'p', the mantissa is normalized
      to [1, 2), and precision is respected.
      
      See golang.org/design/19308-number-literals for background.
      
      For #29008.
      
      Change-Id: I9c1b9612107094856797e5b0b584c556c1914895
      Reviewed-on: https://go-review.googlesource.com/c/160249Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      675503c5
    • Josh Bleecher Snyder's avatar
      cmd/compile: inline checknil · 1e58bb14
      Josh Bleecher Snyder authored
      Now that checknil has only a single caller, inline it.
      
      Passes toolstash-check.
      
      Change-Id: I5b13596bef84dd9a3e7f4bff8560903f1e54acfb
      Reviewed-on: https://go-review.googlesource.com/c/148829
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      1e58bb14
    • Daniel Martí's avatar
      encoding/base32: simplify and speed up decoder · e90e7a59
      Daniel Martí authored
      First, we can lift the enc.decodeMap nil check out of the loop.
      
      Second, we can make it clear to the compiler that 'in := src[0]' doesn't
      need a bounds check, by making len(src)==0 a single if check that always
      stops the loop. This is by far the largest speed-up.
      
      Third, we can use a dst slice index instead of reslicing dst, which
      removes work from the loop body.
      
      While at it, we can merge the two 'switch dlen' pieces of code, which
      simplifies the code and doesn't affect performance.
      
      name            old time/op    new time/op    delta
      DecodeString-8    80.2µs ± 0%    67.5µs ± 0%  -15.81%  (p=0.002 n=6+6)
      
      name            old speed      new speed      delta
      DecodeString-8   163MB/s ± 0%   194MB/s ± 0%  +18.78%  (p=0.002 n=6+6)
      
      Change-Id: Iefeaae94c03453f8760452b1da706a77b3522718
      Reviewed-on: https://go-review.googlesource.com/c/154422
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      e90e7a59
    • Agniva De Sarker's avatar
      go/doc: skip escaping comments in pre-formatted blocks · da50e10c
      Agniva De Sarker authored
      CL 150377 made the change of converting smart quotes to their html escaped entities
      for ToHTML, and to unicode quotes for ToText. But for ToText, the change
      converted the quotes in pre-formatted text too.
      
      This fixes that behavior to not touch any text in pre-formatted blocks, which also
      makes the behavior consistent with ToHTML.
      
      Fixes #29730
      
      Change-Id: I58e0216cbdbe189d06d82147e5a02b620af14734
      Reviewed-on: https://go-review.googlesource.com/c/162922
      Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      da50e10c
    • Agniva De Sarker's avatar
      cmd/compile: fix a typo in assignment mismatch error · 39fa3f17
      Agniva De Sarker authored
      Fixes #30087
      
      Change-Id: Ic6d80f8e6e1831886af8613420b1bd129a1b4850
      Reviewed-on: https://go-review.googlesource.com/c/161577Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      39fa3f17
    • Marat Khabibullin's avatar
      crypto/x509: remove redundant check for nil in tests · 576a3c61
      Marat Khabibullin authored
      Comparing err variable to be not nil is redundant in this case.
      The code above ensures that it is always not nil.
      
      Updates #30208
      
      Change-Id: I0a41601273de36a05d22270a743c0bdedeb1d0bf
      GitHub-Last-Rev: 372e0fd48f90f33e266fbcdf2ccf87b9f1311c4f
      GitHub-Pull-Request: golang/go#30213
      Reviewed-on: https://go-review.googlesource.com/c/162439Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      576a3c61
    • Michael Fraenkel's avatar
      cmd/compile: confusing error if composite literal field is a method · 6d781dec
      Michael Fraenkel authored
      When looking for the field specified in a composite literal, check that
      the specified name is actually a field and not a method.
      
      Fixes #29855.
      
      Change-Id: Id77666e846f925907b1eec64213b1d25af8a2466
      Reviewed-on: https://go-review.googlesource.com/c/158938
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      6d781dec
    • Marat Khabibullin's avatar
      net/textproto: prevent test from failing with nil pointer dereference · c6e47069
      Marat Khabibullin authored
      The variable err could have nil value when we call err.Error(),
      because after we check it for nil above we continue the test
      (t.Errorf doesn't stop the test execution).
      
      Updates #30208
      
      Change-Id: Ibcf38698326c69c06068989510311e37806995c6
      GitHub-Last-Rev: 3ab20f6d7fe34ed9b777e0894b57166d173de8ca
      GitHub-Pull-Request: golang/go#30214
      Reviewed-on: https://go-review.googlesource.com/c/162457Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c6e47069
    • Filippo Valsorda's avatar
      crypto/tls: remove superfluous for label · 8d72e598
      Filippo Valsorda authored
      Change-Id: I8ea3043fcbaf7a5f73b2a796171a7f1cb3cb3693
      Reviewed-on: https://go-review.googlesource.com/c/158818
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      8d72e598
    • Josh Bleecher Snyder's avatar
      cmd/compile: cull dead code · 01971b97
      Josh Bleecher Snyder authored
      The special case for ODOTPTR to handle zero-width fields is unneeded.
      It is an artifact of the old backend, from which time this code dates.
      The Node to SSA converter is careful to insert a nil check.
      This is tested in test/nilptr2.go, among other places.
      
      Passes toolstash-check.
      
      Change-Id: I6c1d99f7ff5abdae9aa08ee047dc088a3fe8dc3c
      Reviewed-on: https://go-review.googlesource.com/c/148828
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      01971b97
    • Elias Naur's avatar
      cmd/dist: skip Fortran tests on Android · 8ca559ee
      Elias Naur authored
      They don't work on Android but will be run if the host has gfortran
      installed.
      
      Change-Id: I983c5695a9e963def90e4f8264fb00077a0c5e53
      Reviewed-on: https://go-review.googlesource.com/c/163838
      Run-TryBot: Elias Naur <mail@eliasnaur.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8ca559ee
    • Ketan Parmar's avatar
      encoding/json: add example for json.HTMLEscape · 8cf1d163
      Ketan Parmar authored
      Change-Id: Ib00fcfd46eae27eea0a3d4cab4406f4c461fb57b
      Reviewed-on: https://go-review.googlesource.com/c/160517Reviewed-by: default avatarAndrew Bonventre <andybons@golang.org>
      Run-TryBot: Andrew Bonventre <andybons@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8cf1d163
    • Daniel Martí's avatar
      text/template: error on method calls on nil interfaces · 15b4c71a
      Daniel Martí authored
      Trying to call a method on a nil interface is a panic in Go. For
      example:
      
      	var stringer fmt.Stringer
      	println(stringer.String()) // nil pointer dereference
      
      In https://golang.org/cl/143097 we started recovering panics encountered
      during function and method calls. However, we didn't handle this case,
      as text/template panics before evalCall is ever run.
      
      In particular, reflect's MethodByName will panic if the receiver is of
      interface kind and nil:
      
      	panic: reflect: Method on nil interface value
      
      Simply add a check for that edge case, and have Template.Execute return
      a helpful error. Note that Execute shouldn't just error if the interface
      contains a typed nil, since we're able to find a method to call in that
      case.
      
      Finally, add regression tests for both the nil and typed nil interface
      cases.
      
      Fixes #30143.
      
      Change-Id: Iffb21b40e14ba5fea0fcdd179cd80d1f23cabbab
      Reviewed-on: https://go-review.googlesource.com/c/161761
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      15b4c71a
    • Daniel Martí's avatar
      cmd/compile: remove unused func eqtypenoname · acf786f4
      Daniel Martí authored
      Its only use was removed in golang.org/cl/114797, committed in October
      2018.
      
      Change-Id: I6560ccfb10d7c763f6470b20c853716779c18cee
      Reviewed-on: https://go-review.googlesource.com/c/158897
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      acf786f4
    • Elias Naur's avatar
      misc/android: copy testdata directories to device before running · 7be432e6
      Elias Naur authored
      We've got away with not copying the testdata directories for the
      standard library because the exec wrapper also pushes almost the
      entire $GOROOT tree to the device, including testdata directories.
      
      Similar to what the iOS exec wrapper does.
      
      Change-Id: I91ef63ef84a658fc8843002890132c64b7c1d20e
      Reviewed-on: https://go-review.googlesource.com/c/163626
      Run-TryBot: Elias Naur <mail@eliasnaur.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      7be432e6
    • Elias Naur's avatar
      misc/android: serialize adb commands on android emulators · 1aa0fcff
      Elias Naur authored
      Android emulator builders are soon to join the trybot set. To avoid
      flaky runs, work around a longstanding adb bug where concurrent adb
      commands sometimes fail.
      
      I haven't seen the problem on actual devices until recently. It seems
      that the recently added "adb wait-for-device" can introduce flakyness
      with errors such as:
      
      adb: error: failed to get feature set: protocol fault (couldn't read status): Connection reset by peer
      
      Instead of working around that, give up and serialize use of adb
      everywhere.
      
      Fixes #23795
      Updates #23824
      
      Change-Id: If347c9981fa32ff8a1e14b7454f122ef682450a6
      Reviewed-on: https://go-review.googlesource.com/c/163625Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      1aa0fcff
    • Elias Naur's avatar
      misc/android,cmd/dist: move $GOROOT copying to the exec wrapper · e3d99a3f
      Elias Naur authored
      To run the standard library tests on Android, the androidtest.bash
      script copies GOROOT to the device. Move that logic to the android
      exec wrapper, thereby making androidtest.bash obsolete.
      
      Apart from making Android less special, the sharded builder
      infrastructure should now be able to run (emulated) Android builders
      and trybots without special treatment.
      
      Updates #23824
      
      Change-Id: I41591fea9a15b38c6dcf84046ea57f1e9165eaa5
      Reviewed-on: https://go-review.googlesource.com/c/163619
      Run-TryBot: Elias Naur <mail@eliasnaur.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      e3d99a3f
    • Elias Naur's avatar
      cmd/vendor/golang.org/x/sys: re-vendor · 3ef7e3d4
      Elias Naur authored
      Fixes #29423
      
      Change-Id: I376d0776c3810c2273d1ea234ebe681d5fd2ae64
      Reviewed-on: https://go-review.googlesource.com/c/163623
      Run-TryBot: Elias Naur <mail@eliasnaur.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarTobias Klauser <tobias.klauser@gmail.com>
      3ef7e3d4
    • Elias Naur's avatar
      cmd/dist: build exec wrappers during bootstrap · da2d02a9
      Elias Naur authored
      The androidtest.bash script encodes the additional steps to build
      Go and run tests on Android. In order to add sharded builders and
      trybots, Android needs to fit into the usual make.bash + cmd/dist test
      pattern.
      
      This change moves building the exec wrapper into cmd/dist bootstrap.
      
      Do the same for iOS while we're here.
      
      Updates #23824
      
      Change-Id: I58a1b0679c3a6c92fdc7fff464b469641f1fee74
      Reviewed-on: https://go-review.googlesource.com/c/163618
      Run-TryBot: Elias Naur <mail@eliasnaur.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      da2d02a9
    • Michael Munday's avatar
      math/bits: optimize Reverse32 and Reverse64 · 42a82ce1
      Michael Munday authored
      Use ReverseBytes32 and ReverseBytes64 to speed up these functions.
      The byte reversal functions are intrinsics on most platforms and
      generally compile to a single instruction.
      
      name       old time/op  new time/op  delta
      Reverse32  2.41ns ± 1%  1.94ns ± 3%  -19.60%  (p=0.000 n=20+19)
      Reverse64  3.85ns ± 1%  2.56ns ± 1%  -33.32%  (p=0.000 n=17+19)
      
      Change-Id: I160bf59a0c7bd5db94114803ec5a59fae448f096
      Reviewed-on: https://go-review.googlesource.com/c/159358
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      42a82ce1
    • Iskander Sharipov's avatar
      net/rpc: fix args order in strings.Contains call · b65ab889
      Iskander Sharipov authored
      The old code looks suspicious and is fragile.
      It would fail if error messages were not totally the same.
      Swapped the arguments order to fix that.
      
      Change-Id: Id5df7242fb9224d0090245286ef8986ebb15e921
      Reviewed-on: https://go-review.googlesource.com/c/161157
      Run-TryBot: Iskander Sharipov <quasilyte@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      b65ab889
    • Daniel Martí's avatar
      text/template: improve nil errors in evalField · 856525ce
      Daniel Martí authored
      If we're accessing a field on a nil struct pointer, and that field is
      present in the type, we should print a "nil pointer evaluating X.Y" error
      instead of the broader "can't evaluate field Y in X". The latter error
      should still be used for the cases where the field is simply missing.
      
      While at it, remove the isNil checks in the struct and map cases. The
      indirect func will only return a true isNil when returning a pointer or
      interface reflect.Value, so it's impossible for either of these checks
      to be useful.
      
      Finally, extend the test suite to test a handful of these edge cases,
      including the one shown in the original issue.
      
      Fixes #29137.
      
      Change-Id: I53408ced8a7b53807a0a8461b6baef1cd01d25ae
      Reviewed-on: https://go-review.googlesource.com/c/153341
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      856525ce
    • Daniel Martí's avatar
      cmd/compile: don't crash on -d=ssa/ · be9c534c
      Daniel Martí authored
      I forgot how to pull up the ssa debug options help, so instead of
      writing -d=ssa/help, I just wrote -d=ssa/. Much to my amusement, the
      compiler just crashed, as shown below. Fix that.
      
      	panic: runtime error: index out of range
      
      	goroutine 1 [running]:
      	cmd/compile/internal/ssa.PhaseOption(0x7ffc375d2b70, 0x0, 0xdbff91, 0x5, 0x1, 0x0, 0x0, 0x1, 0x1)
      	    /home/mvdan/tip/src/cmd/compile/internal/ssa/compile.go:327 +0x1876
      	cmd/compile/internal/gc.Main(0xde7bd8)
      	    /home/mvdan/tip/src/cmd/compile/internal/gc/main.go:411 +0x41d0
      	main.main()
      	    /home/mvdan/tip/src/cmd/compile/main.go:51 +0xab
      
      Change-Id: Ia2ad394382ddf8f4498b16b5cfb49be0317fc1aa
      Reviewed-on: https://go-review.googlesource.com/c/154421
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      be9c534c
    • Alberto Donizetti's avatar
      doc: add 1.12 to the project history · 467456b0
      Alberto Donizetti authored
      Go 1.12 is released, but it's currently not listed in the
      https://golang.org/project page.
      
      Change-Id: Ib5820f74245e4c986014c64eb40fa2911473e64b
      Reviewed-on: https://go-review.googlesource.com/c/163837Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      467456b0