mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
Correct FlagValue interface examples in Readme (#254)
`IsChanged` is actually named `HasChanged`, and the examples were missing function return declarations, so you couldn't just copy/paste it.
This commit is contained in:
parent
51f23d1f1c
commit
c14ce6d43c
1 changed files with 4 additions and 4 deletions
|
@ -277,10 +277,10 @@ Viper provides two Go interfaces to bind other flag systems if you don't use `Pf
|
||||||
|
|
||||||
```go
|
```go
|
||||||
type myFlag struct {}
|
type myFlag struct {}
|
||||||
func (f myFlag) IsChanged() { return false }
|
func (f myFlag) HasChanged() bool { return false }
|
||||||
func (f myFlag) Name() { return "my-flag-name" }
|
func (f myFlag) Name() string { return "my-flag-name" }
|
||||||
func (f myFlag) ValueString() { return "my-flag-value" }
|
func (f myFlag) ValueString() string { return "my-flag-value" }
|
||||||
func (f myFlag) ValueType() { return "string" }
|
func (f myFlag) ValueType() string { return "string" }
|
||||||
```
|
```
|
||||||
|
|
||||||
Once your flag implements this interface, you can simply tell Viper to bind it:
|
Once your flag implements this interface, you can simply tell Viper to bind it:
|
||||||
|
|
Loading…
Reference in a new issue