1. 10
  1.  

  2. 5

    Good read.

    Using Cobra isn’t particularly necessary - the standard library’s flag package is full featured enough (although annoyingly opinionated in not supporting GetOpt style long and short options)

    You could do what I noticed age does and hack around this limitation by adding another flag and prefixing the long option name with a - (dash).

    var str string
    flag.StringVar(&str, "l", "default value", "str help message")
    flag.StringVar(&str, "-long", "default value", "str help message")
    

    Passing --long=value or -l value to the program will do the same, imitating getopt long style.

    1. 1

      Later on I’ve found out age doesn’t actually add a - and that Go’s flag does just support long-style opts all on its own.

      I don’t recall if long opts weren’t supported for a time.

    2. 4

      What the actual hell… get a real router, switch the DSL modem to bridge mode, and enjoy the benefits of a non-braindead PPPoE implementation. There are lots of D-link/Asus/whatever devices you can flash with OpenWRT.