-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
proposal: flag: add url.URL flag type #52622
Comments
how common is this that it needs to be in the stdlib? |
@seankhliao it can be quite handy for passing URLs as flags to binaries. String argument will be parsed using |
Thanks, but handy is not the same as common. A flag like this doesn't need to live in the standard library. It can be implemented entirely outside of the standard library by implementing the So the question here is: what makes this flag important enough to put into the standard library? Thanks. |
@ianlancetaylor DISCLAIMER: It's just my opinion, and I may not see a bigger picture here, or maybe there is a specific reason for not including other stdlib types to |
Wouldn't it be enough to implement TextMarshaler/Unmarshaler for url.URL? |
@uluyol your suggestion seems reasonable to me. I didn't know smth. like this was implemented. It's not released yet, right? |
It looks like flag.TextVar will be part of Go 1.19. |
@uluyol cool, but it's not a blocker to implement TextMarshaler/Unmarshaler interfaces for |
1.19 is the next release, so any change to url will, at the earliest, be in the same release. |
OK, do I need more approvals for implementing TextMarshaler/Unmarshaler interfaces for |
Please open a new issue (and close this one if you don't want it any more). Thanks. |
closed in favor of #52638 |
Add
url.URL
type of flag to existing standard flags implemented inflag
package.Essentially, I want to implemente 4 funcs in
flag/flag.go
:This would allow using it in calling code like so:
The text was updated successfully, but these errors were encountered: