Skip to content

Flag type incompatible with FlagValue interface #825

@mightymatth

Description

@mightymatth

Consider this line documentation of this method:

viper/viper.go

Line 1002 in eabbc68

// Viper.BindFlagValue("port", serverCmd.Flags().Lookup("port"))

Here serverCmd.Flags().Lookup("port") returns Flag type.

And Viper.BindFlagValue() accepts FlagValue interface.

The problem is that Flag type does not match FlagValue interface.

One example is Changed method (defined on Flag type) which differs from HasChanged method (defined in FlagValue interface).

Versions:
viper@v1.6.1
pflag@v1.0.5

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