Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.
This repository was archived by the owner on May 26, 2023. It is now read-only.

type alias for Value, Getter etc. #26

@smyrman

Description

@smyrman

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) {
    ...
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions