Accepted proposal: range over all command-line flags 0 ▲ Redowan's Reflections 2 hours ago · Tech · hide · 0 comments Go’s proposal for package flag was accepted on July 23, 2026. It fixes an awkward case in programs that read the same setting from command-line flags, environment variables, and defaults. Suppose a server has a -debug flag whose default is false: fs := flag.NewFlagSet("serve", flag.ContinueOnError) debug := fs.Bool("debug", false, "enable debug logging") if err := fs.Parse(args); err != nil { return err } The server also reads APP_DEBUG. A command-line flag should win over the environment variable, and the environment variable should win over the default. If the user runs the server with -debug=false while APP_DEBUG=true, the server must keep debug mode off. But *debug is false both when the flag was omitted and when the user explicitly set it to false. The parsed value alone cannot distinguish those cases. The flag package knows which flags were set, but today it exposes that information through two callbacks. Visit walks only the flags that were set successfully. VisitAll walks… No comments yet. Log in to reply on the Fediverse. Comments will appear here.