1. 12 Apr, 2018 2 commits
  2. 11 Apr, 2018 27 commits
  3. 10 Apr, 2018 11 commits
    • Robert Griesemer's avatar
      cmd/compile: better error message when referring to ambiguous method/field · 3d501df4
      Robert Griesemer authored
      Fixes #14321.
      
      Change-Id: I9c92c767b01cf7938c4808a8fef9f2936fc667bc
      Reviewed-on: https://go-review.googlesource.com/106119Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      3d501df4
    • Matthew Dempsky's avatar
      cmd/compile: fix check that ensures main.main is a function · 535ad8ef
      Matthew Dempsky authored
      The check was previously disallowing package main from even importing
      a non-function symbol named "main".
      
      Fixes #24801.
      
      Change-Id: I849b9713890429f0a16860ef16b5dc7e970d04a4
      Reviewed-on: https://go-review.googlesource.com/106120
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      535ad8ef
    • Matthew Dempsky's avatar
      cmd/compile: omit unnecessary interface method expression wrappers · 80bbad01
      Matthew Dempsky authored
      We'll always generate method expression wrappers for declared
      interface types in their own package, so no need to generate them in
      downstream packages.
      
      Noticed by gri@ while looking into #21282.
      
      Change-Id: I4fb7051b4e15297933da05fdd2b111d6b8f4178e
      Reviewed-on: https://go-review.googlesource.com/106175
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      80bbad01
    • Agniva De Sarker's avatar
      go/doc: tune association of a function with a type · 60795360
      Agniva De Sarker authored
      Previously, we used to associate a function with its first returned type
      assuming that it is a factory function for that type.
      
      However, a function may return multiple types in which case it is usually
      doing something else. Check for multiple return types, and treat it as
      a normal function in that case. Maintain same behavior if the function
      returns just one type.
      
      Fixes #12839
      
      Change-Id: Ic4ac11d322996f216f593b71f4e61ad4270d5213
      Reviewed-on: https://go-review.googlesource.com/105575Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      60795360
    • Hana Kim's avatar
      cmd/trace: pprof computation for span types · 95e6a9fc
      Hana Kim authored
      /spanio, /spanblock, /spansched, /spansyscall provide
      the pprof-style summary of span execution's
      io, block, scheduling, syscall latency distributions
      respectively.
      
      The computation logic for /io, /block, /sched, /syscall
      analysis was refactored and extended for reuse in these
      new types of analysis. Upon the analysis query, we create
      a map of goroutine id to time intervals based on the query
      parameter, that represents the interesting time intervals
      of matching goroutines. Only the events from the matching
      goroutines that fall into the intervals are considered
      in the pprof computation.
      
      The new endpoints are not yet hooked into other span
      analysis page (e.g. /userspan) yet.
      
      Change-Id: I80c3396e45a2d6631758710de67d132e5832c7ce
      Reviewed-on: https://go-review.googlesource.com/105822Reviewed-by: 's avatarHeschi Kreinick <heschi@google.com>
      Run-TryBot: Heschi Kreinick <heschi@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      95e6a9fc
    • Keith Randall's avatar
      Revert "runtime: use fixed TLS offsets on darwin/amd64 and darwin/386" · 8bb8eaff
      Keith Randall authored
      This reverts commit 76e92d1c.
      
      Reason for revert: Seems to have broken the darwin/386 builder, the toolchain is barfing on the new inline assembly.
      
      Change-Id: Ic83fa3c85148946529c5fd47d1e1669898031ace
      Reviewed-on: https://go-review.googlesource.com/106155Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      8bb8eaff
    • Vlad Krasnov's avatar
      crypto/elliptic: improve P256 implementation on amd64 a bit · c4a3a9c7
      Vlad Krasnov authored
      Minor modifications to the optimized amd64 implememntation.
      
      * Reduce window size: reduces size of the lookup tables by 40%
      * Revised scalar inversion formula, with less operations
      * Field square function now uses intental loop, saving call overhead
      
      This change will serve as a basis for an arm64 implementation.
      
      Performance results on Skylake MacBook Pro:
      
      pkg:crypto/elliptic goos:darwin goarch:amd64
      BaseMultP256      17.8µs ± 1%    17.5µs ± 1%  -1.41%  (p=0.003 n=10+10)
      ScalarMultP256    70.7µs ± 1%    68.9µs ± 2%  -2.57%  (p=0.000 n=9+9)
      pkg:crypto/ecdsa goos:darwin goarch:amd64
      SignP256          32.7µs ± 1%    31.4µs ± 1%  -3.96%  (p=0.000 n=10+8)
      VerifyP256        95.1µs ± 1%    93.5µs ± 2%  -1.73%  (p=0.001 n=10+9)
      
      name            old alloc/op   new alloc/op   delta
      pkg:crypto/elliptic goos:darwin goarch:amd64
      BaseMultP256        288B ± 0%      288B ± 0%    ~     (all equal)
      ScalarMultP256      256B ± 0%      256B ± 0%    ~     (all equal)
      pkg:crypto/ecdsa goos:darwin goarch:amd64
      SignP256          2.90kB ± 0%    2.90kB ± 0%    ~     (all equal)
      VerifyP256          976B ± 0%      976B ± 0%    ~     (all equal)
      
      name            old allocs/op  new allocs/op  delta
      pkg:crypto/elliptic goos:darwin goarch:amd64
      BaseMultP256        6.00 ± 0%      6.00 ± 0%    ~     (all equal)
      ScalarMultP256      5.00 ± 0%      5.00 ± 0%    ~     (all equal)
      pkg:crypto/ecdsa goos:darwin goarch:amd64
      SignP256            34.0 ± 0%      34.0 ± 0%    ~     (all equal)
      VerifyP256          17.0 ± 0%      17.0 ± 0%    ~     (all equal)
      
      Change-Id: I3f0e2e197a54e7bc7916dedc5dbf085e2c4aea24
      Reviewed-on: https://go-review.googlesource.com/99622Reviewed-by: 's avatarVlad Krasnov <vlad@cloudflare.com>
      Reviewed-by: 's avatarFilippo Valsorda <filippo@golang.org>
      Run-TryBot: Vlad Krasnov <vlad@cloudflare.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c4a3a9c7
    • Hana Kim's avatar
      cmd/trace: skip GoroutineInSyscall in case time order err · efa0d1f2
      Hana Kim authored
      All tests involving trace collection and parsing
      still need handling of failures caused by #16755
      (Timestamp issue)
      
      Fixes #24738
      
      Change-Id: I6cd0f9c6f49854a22fad6fce1a00964c168aa614
      Reviewed-on: https://go-review.googlesource.com/105821Reviewed-by: 's avatarPeter Weinberger <pjw@google.com>
      efa0d1f2
    • Mike Samuel's avatar
      net/http: don't sniff Content-type in Server when X-Content-Type-Options:nosniff · 1a677e03
      Mike Samuel authored
      The docs for ResponseWriter.Write say
      // If the Header
      // does not contain a Content-Type line, Write adds a Content-Type set
      // to the result of passing the initial 512 bytes of written data to
      // DetectContentType.
      
      The header X-Content-Type-Options:nosniff is an explicit directive that
      content-type should not be sniffed.
      
      This changes the behavior of Response.WriteHeader so that, when
      there is an X-Content-Type-Options:nosniff header, but there is
      no Content-type header, the following happens:
      1.  A Content-type:application/octet-stream is added
      2.  A warning is logged via the server's logging mechanism.
      
      Previously, a content-type would have been silently added based on
      heuristic analysis of the first 512B which might allow a hosted
      GIF like http://www.thinkfu.com/blog/gifjavascript-polyglots to be
      categorized as JavaScript which might allow a CSP bypass, loading
      as a script despite `Content-Security-Policy: script-src 'self' `.
      
      ----
      
      https://fetch.spec.whatwg.org/#x-content-type-options-header
      defines the X-Content-Type-Options header.
      
      ["Polyglots: Crossing Origins by Crossing Formats"](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.905.2946&rep=rep1&type=pdf)
      explains Polyglot attacks in more detail.
      
      Change-Id: I2c8800d2e4b4d10d9e08a0e3e5b20334a75f03c0
      Reviewed-on: https://go-review.googlesource.com/89275Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      1a677e03
    • Elias Naur's avatar
      misc/ios: make detect.go more robust · c3cb44fd
      Elias Naur authored
      To enable the exec wrapper go_darwin_arm_exec.go to run binaries
      on iOS devices, the GOIOS_DEV_ID variable needs to be set to a code
      signing identity. The program detect.go attempts to detect suitable
      values for GOIOS_DEV_ID (along with GOIOS_APP_ID and GOIOS_TEAM_ID).
      
      Before this change, detect.go would use "security find-identity
      -p codesigning -v" to list all available identities for code signing
      and pick the first one with "iPhone Developer" in its name. However,
      that pick might be invalid since if it was replaced by an identity
      issued later.
      
      For example, on the mobile builder:
      
      $ security find-identity -p codesigning -v
        1) 0E251DE41FE4490574E475AC320B47F58D6D3635 "lldb_codesign"
        2) 0358588D07AA6A19478981BA405F40A97F95F187 "iPhone Developer: xxx@xxx (2754T98W8E)"
        3) FC6D96F24A3223C98BF7A2C2C5194D82E04CD23E "iPhone Developer: xxx@xxx (2754T98W8E)"
           3 valid identities found
      
      In this case, the identity 0358588D07AA6A19478981BA405F40A97F95F187
      is picked by detect.go even though it has been invalidated by
      FC6D96F24A3223C98BF7A2C2C5194D82E04CD23E.
      
      Instead of attempting to find an identity from the "security
      find-identity" list, use the identity from the CommonName in the
      embedded certificate in the provisioning file. The CommonName only
      lists the identity name (iPhone Developer: xxx@xxx (2754T98W8E)),
      not the fingerprint (FC6D96F24A3223C98BF7A2C2C5194D82E04CD23E), but
      fortunately the codesign tool accepts both.
      
      Identity names may not be unique, as demonstrated by the example,
      but that will result in an ambiguity error at codesigning instead of
      a more obscure error about an invalid identity when
      go_darwin_arm_exec.go runs a binary.
      The fix is then to delete the invalid identity from the system
      keychain.
      
      While here, find all connected devices instead of the first connected
      and only consider provision files that covers them all. This matters
      for the mobile builder where two devices are connected.
      
      Change-Id: I6beb59ace3fc5e071ba76222a20a607765943989
      Reviewed-on: https://go-review.googlesource.com/105436
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarHyang-Ah Hana Kim <hyangah@gmail.com>
      c3cb44fd
    • Meng Zhuo's avatar
      runtime: use internal/cpu in alginit · 6b5236ae
      Meng Zhuo authored
      After CL 104636 the feature flags in internal/cpu are initialized before
      alginit and can now be used for aeshash feature detection. Also remove
      now unused runtime variables:
      x86:
      	support_ssse3
      	support_sse42
      	support_aes
      arm64:
      	support_aes
      
      Change-Id: I2f64198d91750eaf3c6cf2aac6e9e17615811ec8
      Reviewed-on: https://go-review.googlesource.com/106015
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      6b5236ae