40
40
}
41
41
)
42
42
43
- // BindOpt is an option for the Bind method
43
+ // BindOpt is an option for the Bind method.
44
44
type BindOpt struct {
45
45
isDev * bool
46
46
isSetup * bool
@@ -73,7 +73,7 @@ func SetupMode() BindOpt {
73
73
// UseDevDefaults forces the bind call to use development defaults unless
74
74
// UseReleaseDefaults is provided as a subsequent option.
75
75
// Without either, Bind will default to determining which defaults to use
76
- // based on version.Build.Release
76
+ // based on version.Build.Release.
77
77
func UseDevDefaults () BindOpt {
78
78
dev := true
79
79
return BindOpt {isDev : & dev }
@@ -82,7 +82,7 @@ func UseDevDefaults() BindOpt {
82
82
// UseReleaseDefaults forces the bind call to use release defaults unless
83
83
// UseDevDefaults is provided as a subsequent option.
84
84
// Without either, Bind will default to determining which defaults to use
85
- // based on version.Build.Release
85
+ // based on version.Build.Release.
86
86
func UseReleaseDefaults () BindOpt {
87
87
dev := false
88
88
return BindOpt {isDev : & dev }
@@ -367,22 +367,22 @@ func expand(vars map[string]string, val string) string {
367
367
return os .Expand (val , func (key string ) string { return vars [key ] })
368
368
}
369
369
370
- // FindConfigDirParam returns '--config-dir' param from os.Args (if exists)
370
+ // FindConfigDirParam returns '--config-dir' param from os.Args (if exists).
371
371
func FindConfigDirParam () string {
372
372
return FindFlagEarly ("config-dir" )
373
373
}
374
374
375
- // FindIdentityDirParam returns '--identity-dir' param from os.Args (if exists)
375
+ // FindIdentityDirParam returns '--identity-dir' param from os.Args (if exists).
376
376
func FindIdentityDirParam () string {
377
377
return FindFlagEarly ("identity-dir" )
378
378
}
379
379
380
- // FindDefaultsParam returns '--defaults' param from os.Args (if it exists)
380
+ // FindDefaultsParam returns '--defaults' param from os.Args (if it exists).
381
381
func FindDefaultsParam () string {
382
382
return FindFlagEarly ("defaults" )
383
383
}
384
384
385
- // FindFlagEarly retrieves the value of a flag before `flag.Parse` has been called
385
+ // FindFlagEarly retrieves the value of a flag before `flag.Parse` has been called.
386
386
func FindFlagEarly (flagName string ) string {
387
387
// workaround to have early access to 'dir' param
388
388
for i , arg := range os .Args {
@@ -395,7 +395,7 @@ func FindFlagEarly(flagName string) string {
395
395
return ""
396
396
}
397
397
398
- // SetupFlag sets up flags that are needed before `flag.Parse` has been called
398
+ // SetupFlag sets up flags that are needed before `flag.Parse` has been called.
399
399
func SetupFlag (log * zap.Logger , cmd * cobra.Command , dest * string , name , value , usage string ) {
400
400
if foundValue := FindFlagEarly (name ); foundValue != "" {
401
401
value = foundValue
@@ -406,7 +406,7 @@ func SetupFlag(log *zap.Logger, cmd *cobra.Command, dest *string, name, value, u
406
406
}
407
407
}
408
408
409
- // DefaultsType returns the type of defaults (release/dev) this binary should use
409
+ // DefaultsType returns the type of defaults (release/dev) this binary should use.
410
410
func DefaultsType () string {
411
411
// define a flag so that the flag parsing system will be happy.
412
412
defaults := strings .ToLower (FindDefaultsParam ())
@@ -420,7 +420,7 @@ func DefaultsType() string {
420
420
}
421
421
422
422
// DefaultsFlag sets up the defaults=dev/release flag options, which is needed
423
- // before `flag.Parse` has been called
423
+ // before `flag.Parse` has been called.
424
424
func DefaultsFlag (cmd * cobra.Command ) BindOpt {
425
425
// define a flag so that the flag parsing system will be happy.
426
426
defaults := DefaultsType ()
0 commit comments