You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MarkDeprecated and NormalizeFunc as alias results in an inconsistent deprecation message #279
cmd.Flags().StringVar(&src, "dir", "", "deprecated, use src")
cmd.Flags().MarkDeprecated("dir", "dir has been renamed src")
cmd.Flags().StringVar(&src, "src", "", "src directory or file")
cmd.Flags().SetNormalizeFunc(aliasNormalizeFunc)
$ go run . --dir=test
Flag --src has been deprecated, dir has been renamed src
This issue has not been updated in a long time. Is it still relevant?
(If I receive no answer before the end of the summer, I'll close it. Feel free to re-open if you come here after that happens and it is relevant to you - but if you do, please also comment and specify what outcome you're interested in!)
Still reproduces on main. With an alias set up via SetNormalizeFunc, using the alias for a deprecated flag reports the canonical name instead of the one you typed:
$ go run . --dir=test
Flag --src has been deprecated, dir has been renamed src
Parse passes the normalized flag.Name into Set, so the typed name is lost before the message is built. Outcome I'd want: report the flag as typed, Flag --dir has been deprecated, .... Opened #500 with a small fix.
Activity
tomasaschan commentedon Jul 16, 2025
This issue has not been updated in a long time. Is it still relevant?
(If I receive no answer before the end of the summer, I'll close it. Feel free to re-open if you come here after that happens and it is relevant to you - but if you do, please also comment and specify what outcome you're interested in!)
hdimer commentedon Jul 30, 2026
Still reproduces on main. With an alias set up via
SetNormalizeFunc, using the alias for a deprecated flag reports the canonical name instead of the one you typed:Parsepasses the normalizedflag.NameintoSet, so the typed name is lost before the message is built. Outcome I'd want: report the flag as typed,Flag --dir has been deprecated, .... Opened #500 with a small fix.fix: report the flag name as typed in deprecation warnings