1
0

options.go 470 B

1234567891011121314151617181920
  1. package flag
  2. import (
  3. "context"
  4. "gogs.baozhida.cn/zoie/OAuth-core/config/source"
  5. )
  6. type includeUnsetKey struct{}
  7. // IncludeUnset toggles the loading of unset flags and their respective default values.
  8. // Default behavior is to ignore any unset flags.
  9. func IncludeUnset(b bool) source.Option {
  10. return func(o *source.Options) {
  11. if o.Context == nil {
  12. o.Context = context.Background()
  13. }
  14. o.Context = context.WithValue(o.Context, includeUnsetKey{}, true)
  15. }
  16. }