1. 27 Mar, 2019 1 commit
    • Brad Fitzpatrick's avatar
      context: don't depend on fmt · 724a86fc
      Brad Fitzpatrick authored
      So the net package doesn't indirectly depend on unicode tables.
      
      But we're still not quite there, because a new test added in this CL
      reveals that we still have a path to unicode via:
      
      deps_test.go:570:
        TODO(issue 30440): policy violation: net => sort => reflect => unicode
      
      Updates #30440
      
      Change-Id: I710c2061dfbaa8e866c92e6c824bd8df35784165
      Reviewed-on: https://go-review.googlesource.com/c/go/+/169080Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      724a86fc
  2. 26 Mar, 2019 9 commits
  3. 25 Mar, 2019 21 commits
  4. 24 Mar, 2019 3 commits
    • sergey's avatar
      net/url: check for lowercase before uppercase in shouldEscape · c7bb4533
      sergey authored
      Most chars in URLs are lowercase, so check that first.
      
      Performance change:
      
      String-4               7.62µs ± 1%    7.27µs ± 3%  -4.61%  (p=0.008 n=5+5)
      QueryEscape/#00-4      92.6ns ± 3%    90.3ns ± 1%  -2.48%  (p=0.016 n=5+5)
      QueryEscape/#01-4       515ns ± 4%     510ns ± 2%    ~     (p=0.683 n=5+5)
      QueryEscape/#02-4       375ns ± 1%     343ns ± 1%  -8.52%  (p=0.008 n=5+5)
      QueryEscape/#03-4       758ns ± 1%     699ns ± 1%  -7.83%  (p=0.008 n=5+5)
      QueryEscape/#04-4      6.06µs ± 1%    5.74µs ± 1%  -5.38%  (p=0.008 n=5+5)
      PathEscape/#00-4        140ns ± 1%     135ns ± 2%  -3.85%  (p=0.008 n=5+5)
      PathEscape/#01-4        511ns ± 3%     507ns ± 3%    ~     (p=0.587 n=5+5)
      PathEscape/#02-4        372ns ± 1%     342ns ± 2%  -8.22%  (p=0.008 n=5+5)
      PathEscape/#03-4        747ns ± 1%     685ns ± 1%  -8.30%  (p=0.008 n=5+5)
      PathEscape/#04-4       5.94µs ± 1%    5.64µs ± 3%  -4.98%  (p=0.008 n=5+5)
      QueryUnescape/#00-4     111ns ± 4%     110ns ± 2%    ~     (p=0.952 n=5+5)
      QueryUnescape/#01-4     390ns ± 0%     391ns ± 2%    ~     (p=0.714 n=5+5)
      QueryUnescape/#02-4     297ns ± 5%     295ns ± 3%    ~     (p=0.524 n=5+5)
      QueryUnescape/#03-4     543ns ± 3%     556ns ± 2%  +2.39%  (p=0.032 n=5+5)
      QueryUnescape/#04-4    3.23µs ± 3%    3.22µs ± 2%    ~     (p=1.000 n=5+5)
      PathUnescape/#00-4      111ns ± 1%     110ns ± 3%    ~     (p=0.881 n=5+5)
      PathUnescape/#01-4      389ns ± 2%     386ns ± 2%    ~     (p=0.444 n=5+5)
      PathUnescape/#02-4      297ns ± 1%     295ns ± 3%    ~     (p=0.738 n=5+5)
      PathUnescape/#03-4      557ns ± 3%     553ns ± 2%    ~     (p=0.810 n=5+5)
      PathUnescape/#04-4     2.94µs ± 2%    2.97µs ± 2%    ~     (p=0.222 n=5+5)
      
      Change-Id: I7e6d64cd5f8f5218cb40f52f0015168a8674aabb
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168883Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c7bb4533
    • Alex Brainman's avatar
      cmd/go: keep WINDIR during TestScript · 7722f6d2
      Alex Brainman authored
      TestScript executes PowerShell. And PowerShell appears to require
      WINDIR environment variable to exists on windows-arm.
      
      So keep WINDIR environment variable when running PowerShell.
      
      Fixes #30711
      
      Change-Id: I14dde6614347325a8f3caf994ea8ab05294450a5
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168859
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      7722f6d2
    • Daniel Martí's avatar
      text/template: allow using -}} with many spaces · e770b5b3
      Daniel Martí authored
      lexSpace consumed all spaces, even if the last one was part of a right
      delimiter like " -}}". Thus, "3  -}}" wouldn't lex as "3" and a right
      delimiter, but as "3", "-", and "}}".
      
      To fix that, make lexSpace stop if it encounters a right delimiter.
      
      Fixes #30948.
      
      Change-Id: I80a5546e5809e54f6823e2bf3a57a7e8808329be
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168457Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      e770b5b3
  5. 23 Mar, 2019 3 commits
  6. 22 Mar, 2019 3 commits
    • Austin Clements's avatar
      testing: fix fractional ns/op printing · 1257d050
      Austin Clements authored
      CL 166717 changed the way ns/op benchmark results were printed and
      inadvertently rounded all ns/op results down to an integer, even if
      they were small enough to print with digits after the decimal place.
      For example, prior to this change, we got output like
      
          BenchmarkFast-8       380491575	 3.12 ns/op
      
      CL 166717 changed this to
      
          BenchmarkFast-8       380491575      3.00 ns/op
      
      This had the further side-effect that ns/op values between 0 and 1
      would not be printed at all because they would be rounded down to 0.
      
      This CL fixes this by always recomputing the float64 value of ns/op
      instead of using the int64 truncation from BenchmarkResult.NsPerOp.
      
      Fixes #30997. Fixes #31005.
      
      Change-Id: I21f73b9d5cc5ad41e7ff535675d07ca00051ecd7
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168937Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      1257d050
    • Dmitri Shuralyov's avatar
      cmd/go: fix the default build output name for versioned binaries · 94563de8
      Dmitri Shuralyov authored
      This change is a re-apply of the reverted CL 140863 with changes to
      address issue #30821. Specifically, path.Split continues to be used
      to split the '/'-separated import path, rather than filepath.Split.
      
      Document the algorithm for how the default executable name is determined
      in DefaultExecName.
      
      Rename a variable returned from os.Stat from bs to fi for consistency.
      
      CL 140863 factored out the logic to determine the default executable
      name from the Package.load method into a DefaultExecName function,
      and started using it in more places to avoid having to re-implement
      the logic everywhere it's needed. Most previous callers already computed
      the default executable name based on the import path. The load.Package
      method, before CL 140863, was the exception, in that it used the p.Dir
      value in GOPATH mode instead. There was a NOTE(rsc) comment that it
      should be equivalent to use import path, but it was too late in Go 1.11
      cycle to risk implementing that change.
      
      This is part 1, a more conservative change for backporting to Go 1.12.2,
      and it keeps the original behavior of splitting on p.Dir in GOPATH mode.
      Part 2 will address the NOTE(rsc) comment and modify behavior in
      Package.load to always use DefaultExecName which splits the import path
      rather than directory. It is intended to be included in Go 1.13.
      
      Fixes #27283 (again)
      Updates #26869
      Fixes #30821
      
      Change-Id: Ib1ebb95acba7c85c24e3a55c40cdf48405af34f3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167503Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
      Reviewed-by: default avatarHyang-Ah Hana Kim <hyangah@gmail.com>
      94563de8
    • Dmitri Shuralyov's avatar
      Revert "cmd/go: fix the default build output name for versioned binaries" · 1e83369c
      Dmitri Shuralyov authored
      This reverts CL 140863 (commit bf94fc3a).
      
      Reason for revert: There was a potential problem spotted in the original
      fix, which resulted in it being rolled back from release-branch.go1.12
      and not included in Go 1.12.1 release. We intend to improve the fix and
      include it in Go 1.12.2 instead. To make the fix easier to backport,
      revert this change before re-applying the improved fix (next commit).
      
      Change-Id: If6c785f58482d2531b5927c5ea7002f548c21c7c
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168402Reviewed-by: default avatarHyang-Ah Hana Kim <hyangah@gmail.com>
      1e83369c