Correct FlagValue interface examples in Readme

`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:
Nils Landt 2016-10-12 08:05:31 +02:00 committed by GitHub
parent 51f23d1f1c
commit 70195d3cd5

View file

@ -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: