Navigation Menu

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: impossible to override the CommandLine usage #7779

Closed
gopherbot opened this issue Apr 14, 2014 · 5 comments
Closed

flag: impossible to override the CommandLine usage #7779

gopherbot opened this issue Apr 14, 2014 · 5 comments
Milestone

Comments

@gopherbot
Copy link

by jonas@pfenniger.name:

The flag package special-cases the usage for the default flag.CommandLine FlagSet. It
makes it impossible to override the module-level usage.

See: http://golang.org/src/pkg/flag/flag.go?s=22406:22467#L703

The flag.Usage() could be set to the flag.CommandLine in an init() instead.
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-go1.4.

@rsc
Copy link
Contributor

rsc commented Sep 15, 2014

Comment 2:

Can you please point to specific code? I can't tell what the problem is.
Note that you can reassign flag.Usage in your func main.

Status changed to WaitingForReply.

@gopherbot
Copy link
Author

Comment 3 by jonas@pfenniger.name:

Sorry for the confusion.
It's possible to set flag.Usage and have a different usage output. What's not possible
it to pass in CommandLine into a flagset-configuring function and have the usage
updated. Here is an example: http://play.golang.org/p/uaycqgIurf
Arguably this is a nitpick. The FlagSet usage() function could be changed to something
like this to support both cases: https://gist.github.com/zimbatm/e652a0e7342833d73f99

@gopherbot
Copy link
Author

Comment 4:

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

@robpike
Copy link
Contributor

robpike commented Sep 26, 2014

Comment 5:

This issue was closed by revision b2487ef.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Fixes golang#7779.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/147210043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
Fixes golang#7779.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/147210043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
Fixes golang#7779.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/147210043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
Fixes golang#7779.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/147210043
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants