]> Cypherpunks.ru repositories - gostls13.git/commit
flag: arrange for FlagSet.Usage to be non-nil by default
authorRuss Cox <rsc@golang.org>
Thu, 20 Oct 2016 19:05:51 +0000 (15:05 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 26 Oct 2016 16:13:40 +0000 (16:13 +0000)
commit49543695c56486d6a941e55520b37a9d098d3379
tree171c24be185df7c89d8da3adfb32e41c62cea910
parentf9027d61ab48154e4cb29c50e356a3f462840e01
flag: arrange for FlagSet.Usage to be non-nil by default

This allows callers to invoke f.Usage() themselves and get the default
usage handler instead of a panic (from calling a nil function).

Fixes #16955.

Change-Id: Ie337fd9e1f85daf78c5eae7b5c41d5ad8c1f89bf
Reviewed-on: https://go-review.googlesource.com/31576
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
src/flag/export_test.go
src/flag/flag.go