Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flag: NewFlagSet returns a FlagSet with a nil Usage func #16955

Closed
d3ce1t opened this issue Sep 1, 2016 · 2 comments
Closed

flag: NewFlagSet returns a FlagSet with a nil Usage func #16955

d3ce1t opened this issue Sep 1, 2016 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@d3ce1t
Copy link

d3ce1t commented Sep 1, 2016

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.6.3 darwin/amd64

What operating system and processor architecture are you using (go env)?

Mac OS X 10.11.6
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"

What did you do?

Create a new flag.FlagSet and call Usage() function.

Please, find the source code related to this issue in the following link: https://play.golang.org/p/_GujXXUvno

What did you expect to see?

Printed information on screen about used flags.

What did you see instead?

Runtime error because of nil pointer dereference

@bradfitz bradfitz changed the title FlagSet.Usage func() is nil after calling flag.NewFlagSet causing a panic when Usage() is called flag: NewFlagSet returns a FlagSet with a nil Usage func Sep 1, 2016
@bradfitz
Copy link
Contributor

bradfitz commented Sep 1, 2016

It's been like this since Go 1: https://github.com/golang/go/blob/release-branch.go1/src/pkg/flag/flag.go#L785

So, super low priority. Maybe documentation.

/cc @robpike

@quentinmit quentinmit added this to the Go1.8Maybe milestone Sep 6, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 10, 2016
@gopherbot
Copy link

CL https://golang.org/cl/31576 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants