github.com/annwntech/go-micro/v2@v2.9.5/config/source/flag/options.go (about) 1 package flag 2 3 import ( 4 "context" 5 6 "github.com/annwntech/go-micro/v2/config/source" 7 ) 8 9 type includeUnsetKey struct{} 10 11 // IncludeUnset toggles the loading of unset flags and their respective default values. 12 // Default behavior is to ignore any unset flags. 13 func IncludeUnset(b bool) source.Option { 14 return func(o *source.Options) { 15 if o.Context == nil { 16 o.Context = context.Background() 17 } 18 o.Context = context.WithValue(o.Context, includeUnsetKey{}, true) 19 } 20 }