Documentation ¶
Overview ¶
Package feature provides a simple mechanism for command line tools to take and parse feature flags.
Feature flag sets are passed as a struct of booleans. Non-boolean fields are ignored during parsing.
Example ¶
package main import ( "fmt" "github.com/scionproto/scion/private/app/feature" ) func main() { var featureSet struct { One bool `feature:"feature_one"` Two bool `feature:"feature_two"` } if err := feature.Parse([]string{"feature_one"}, &featureSet); err != nil { panic(err) } fmt.Printf("%+v\n", featureSet) }
Output: {One:true Two:false}
Example (NotSupported) ¶
package main import ( "fmt" "github.com/scionproto/scion/private/app/feature" ) func main() { var featureSet struct { One bool `feature:"named"` } err := feature.Parse([]string{"one"}, &featureSet) fmt.Println(err.Error()) }
Output: feature not supported {feature=one}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Features ¶
func Features(featureSet interface{}) []string
Features lists the supported features.
Types ¶
Click to show internal directories.
Click to hide internal directories.