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