1. 19 Nov, 2017 4 commits
    • Daniel Martí's avatar
      cmd/doc: print a symbol error on "bytes Foo" · 207c53e0
      Daniel Martí authored
      In golang.org/cl/59413, the two-argument behavior of cmd/doc was changed
      to use findPackage instead of build.Import, meaning that the tool was
      more consistent and useful.
      
      However, it introduced a regression:
      
      	$ go doc bytes Foo
      	doc: no such package: bytes
      
      This is because the directory list search would not find Foo in bytes,
      and reach the end of the directory list - thus resulting in a "no such
      package" error, since no directory matched our first argument.
      
      Move the "no such package" error out of parseArgs, so that the "loop
      until something is printed" loop can have control over it. In
      particular, it is useful to know when we have reached the end of the
      list without any exact match, yet we did find one package matching
      "bytes":
      
      	$ go doc bytes Foo
      	doc: no symbol Foo in package bytes
      
      While at it, make the "no such package" error not be fatal so that we
      may test for it. It is important to have the test, as parseArgs may now
      return a nil package instead of exiting the entire program, potentially
      meaning a nil pointer dereference panic.
      
      Fixes #22810.
      
      Change-Id: I90cc6fd755e2d1675bea6d49a1c13cc18ac9bfb9
      Reviewed-on: https://go-review.googlesource.com/78677
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      207c53e0
    • Daniel Martí's avatar
      bytes: don't use an iota for the readOp constants · f91ab6c0
      Daniel Martí authored
      As per the comments in golang.org/cl/78617. Also leaving a comment here,
      to make sure noone else thinks to re-introduce the iota like I did.
      
      Change-Id: I2a2275998b81896eaa0e9d5ee0197661ebe84acf
      Reviewed-on: https://go-review.googlesource.com/78676
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      f91ab6c0
    • Kunpei Sakai's avatar
      testing: fix invalid error message about argument of TestMain · e4a3043d
      Kunpei Sakai authored
      Also, this commit adds a test for ensuring that TestMain(t *testing.T) is a normal test.
      
      Fixes #22388
      
      Change-Id: Iffcb1db5cdcf34b9c822fcdb58f8926535415177
      Reviewed-on: https://go-review.googlesource.com/72591
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      e4a3043d
    • Ross Chater's avatar
      time: fix typo in doc · 50181df8
      Ross Chater authored
      Change-Id: I44bd5fa14ac6c4367927ae312e03ede06fcc7bb9
      Reviewed-on: https://go-review.googlesource.com/78675Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      50181df8
  2. 18 Nov, 2017 8 commits
  3. 17 Nov, 2017 11 commits
  4. 16 Nov, 2017 17 commits