github.com/chanzuckerberg/terraform@v0.11.12-beta1/helper/experiment/id.go (about) 1 package experiment 2 3 // ID represents an experimental feature. 4 // 5 // The global vars defined on this package should be used as ID values. 6 // This interface is purposely not implement-able outside of this package 7 // so that we can rely on the Go compiler to enforce all experiment references. 8 type ID interface { 9 Env() string 10 Flag() string 11 Default() bool 12 13 unexported() // So the ID can't be implemented externally. 14 } 15 16 // basicID implements ID. 17 type basicID struct { 18 EnvValue string 19 FlagValue string 20 DefaultValue bool 21 } 22 23 func newBasicID(flag, env string, def bool) ID { 24 return &basicID{ 25 EnvValue: env, 26 FlagValue: flag, 27 DefaultValue: def, 28 } 29 } 30 31 func (id *basicID) Env() string { return id.EnvValue } 32 func (id *basicID) Flag() string { return id.FlagValue } 33 func (id *basicID) Default() bool { return id.DefaultValue } 34 func (id *basicID) unexported() {}