1. 19 Sep, 2019 2 commits
    • Gert Cuykens's avatar
      cmd/doc: add option to output a clean one-line symbol representation · fa42157d
      Gert Cuykens authored
      Currently there is no way for go doc to output a clean
      one-line symbol representation of types, functions, vars
      and consts without documentation lines or other text lines
      added.
      
      For example `go doc fmt` has a huge introduction so if you
      pass that to grep or fzf to search a symbol let say scan
      `go doc fmt | grep scan` you get way to many false
      positives.
      
      Added a `-short` flag to be able to do
      `go doc -short fmt | grep scan` instead which will result in
      just the symbols you are looking for.
      
      func Fscan(r io.Reader, a ...interface{}) (n int, err error)
      func Fscanf(r io.Reader, format string, a ...interface{}) (n int, err error)
      func Fscanln(r io.Reader, a ...interface{}) (n int, err error)
      func Sscan(str string, a ...interface{}) (n int, err error)
      func Sscanf(str string, format string, a ...interface{}) (n int, err error)
      func Sscanln(str string, a ...interface{}) (n int, err error)
      
      
      Fixes #32597
      
      Change-Id: I77a73838adc512c8d1490f5a82075de6b0462a31
      Reviewed-on: https://go-review.googlesource.com/c/go/+/184017
      Run-TryBot: Andrew Bonventre <andybons@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAndrew Bonventre <andybons@golang.org>
      fa42157d
    • Andrew's avatar
      doc/go1.13: add id tag to note about removal of NaCl port in Go 1.14 · b7e9c7a3
      Andrew authored
      This was in response to a post-merge review comment in
      golang.org/cl/185537
      
      Change-Id: I866b3882c8e83bf1fef60115cff5d1c6a9863f09
      Reviewed-on: https://go-review.googlesource.com/c/go/+/186319Reviewed-by: default avatarAndrew Bonventre <andybons@golang.org>
      b7e9c7a3
  2. 18 Sep, 2019 24 commits
  3. 17 Sep, 2019 12 commits
  4. 16 Sep, 2019 2 commits
    • Matthew Dempsky's avatar
      cmd/compile: major refactoring of switch walking · 8f3d9855
      Matthew Dempsky authored
      There are a lot of complexities to handling switches efficiently:
      
      1. Order matters for expression switches with non-constant cases and
      for type expressions with interface types. We have to respect
      side-effects, and we also can't allow later cases to accidentally take
      precedence over earlier cases.
      
      2. For runs of integers, floats, and string constants in expression
      switches or runs of concrete types in type switches, we want to emit
      efficient binary searches.
      
      3. For runs of consecutive integers in expression switches, we want to
      collapse them into range comparisons.
      
      4. For binary searches of strings, we want to compare by length first,
      because that's more efficient and we don't need to respect any
      particular ordering.
      
      5. For "switch true { ... }" and "switch false { ... }", we want to
      optimize "case x:" as simply "if x" or "if !x", respectively, unless x
      is interface-typed.
      
      The current swt.go code reflects how these constraints have been
      incrementally added over time, with each of them being handled ad
      hocly in different parts of the code. Also, the existing code tries
      very hard to reuse logic between expression and type switches, even
      though the similarities are very superficial.
      
      This CL rewrites switch handling to better abstract away the logic
      involved in constructing the binary searches. In particular, it's
      intended to make further optimizations to switch dispatch much easier.
      
      It also eliminates the need for both OXCASE and OCASE ops, and a
      subsequent CL can collapse the two.
      
      Passes toolstash-check.
      
      Change-Id: Ifcd1e56f81f858117a412971d82e98abe7c4481f
      Reviewed-on: https://go-review.googlesource.com/c/go/+/194660
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      8f3d9855
    • Matthew Dempsky's avatar
      test: add test coverage for type-switch hash collisions · 115e4c9c
      Matthew Dempsky authored
      This CL expands the test for #29612 to check that type switches also
      work correctly when type hashes collide.
      
      Change-Id: Ia153743e6ea0736c1a33191acfe4d8ba890be527
      Reviewed-on: https://go-review.googlesource.com/c/go/+/195782
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      115e4c9c