namsral/flag

type alias for Value, Getter etc.

smyrman opened this issue · 0 comments

Could it be a good idea to let interface types like Value and Getter be type-aliases to the interfaces defined in the official flag package?

This would allow e.g. defining an interface for FlagSet in your own applications or libraries, that is able to accept both a FlagSet from this package or a FlagSet from the standard library, when a method with interface parameters is required.

import "flag"

type Value  = flag.Package
type Getter = flag.Getter

Application example:

package example

import "flag"

type FlagSet interface {
    Var(value flag.Value, name string, usage string)
}

func AddFlags(set FlagSet) {
    ...
}