@@ -62,12 +62,12 @@ var (
62
62
// some of these errors didn't follow naming conventions when they were introduced.
63
63
// for backward compatibility reasons, they can't be changed and have nolint directives.
64
64
65
- // ErrorEmptyConfigValue indicates the value for the configuration option was empty.
66
- ErrorEmptyConfigValue = errors .New ("config value set to empty" ) //nolint:errname
67
- // ErrorValueConversion indicates an unexpected type was found for the value of the config option.
68
- ErrorValueConversion = errors .New ("unexpected type, cannot convert value" ) //nolint:errname
69
- // ErrorNoConfig indicates no config file was provided, or flag.Parse() was not called.
70
- ErrorNoConfig = errors .New ("no configuration file provided with --" + configFlag ) //nolint:errname
65
+ // ErrEmptyConfigValue indicates the value for the configuration option was empty.
66
+ ErrEmptyConfigValue = errors .New ("config value set to empty" )
67
+ // ErrValueConversion indicates an unexpected type was found for the value of the config option.
68
+ ErrValueConversion = errors .New ("unexpected type, cannot convert value" )
69
+ // ErrNoConfig indicates no config file was provided, or flag.Parse() was not called.
70
+ ErrNoConfig = errors .New ("no configuration file provided with --" + configFlag )
71
71
//go:embed config.yaml
72
72
configYAML []byte
73
73
configFilename = flag .String (configFlag , configDefault , configUsage )
@@ -121,12 +121,12 @@ func getStringConfigValue(envVar string, byteValue []byte, fieldName, configName
121
121
return "" , fmt .Errorf ("error getting config value %s: %w" , configName , err )
122
122
}
123
123
if value .Kind () != reflect .String {
124
- return "" , fmt .Errorf ("%w: %s, %s" , ErrorValueConversion , value .Type ().Name (), configName )
124
+ return "" , fmt .Errorf ("%w: %s, %s" , ErrValueConversion , value .Type ().Name (), configName )
125
125
}
126
126
if value .String () != "" {
127
127
return value .String (), nil
128
128
}
129
- return value .String (), fmt .Errorf ("%w: %s" , ErrorEmptyConfigValue , configName )
129
+ return value .String (), fmt .Errorf ("%w: %s" , ErrEmptyConfigValue , configName )
130
130
}
131
131
132
132
func getIntConfigValue (envVar string , byteValue []byte , fieldName , configName string ) (int , error ) {
@@ -142,7 +142,7 @@ func getIntConfigValue(envVar string, byteValue []byte, fieldName, configName st
142
142
case reflect .Int :
143
143
return int (value .Int ()), nil
144
144
default :
145
- return 0 , fmt .Errorf ("%w: %s, %s" , ErrorValueConversion , value .Type ().Name (), configName )
145
+ return 0 , fmt .Errorf ("%w: %s, %s" , ErrValueConversion , value .Type ().Name (), configName )
146
146
}
147
147
}
148
148
@@ -159,7 +159,7 @@ func getFloat64ConfigValue(envVar string, byteValue []byte, fieldName, configNam
159
159
case reflect .Float32 , reflect .Float64 :
160
160
return value .Float (), nil
161
161
default :
162
- return 0 , fmt .Errorf ("%w: %s, %s" , ErrorValueConversion , value .Type ().Name (), configName )
162
+ return 0 , fmt .Errorf ("%w: %s, %s" , ErrValueConversion , value .Type ().Name (), configName )
163
163
}
164
164
}
165
165
@@ -183,11 +183,11 @@ func getMapConfigValue(byteValue []byte, fieldName, configName, subMapName strin
183
183
return map [string ]string {}, fmt .Errorf ("error getting config value %s: %w" , configName , err )
184
184
}
185
185
if value .Kind () != reflect .Map {
186
- return map [string ]string {}, fmt .Errorf ("%w: %s, %s" , ErrorValueConversion , value .Type ().Name (), configName )
186
+ return map [string ]string {}, fmt .Errorf ("%w: %s, %s" , ErrValueConversion , value .Type ().Name (), configName )
187
187
}
188
188
subMap := value .MapIndex (reflect .ValueOf (subMapName ))
189
189
if subMap .Kind () != reflect .Map {
190
- return map [string ]string {}, fmt .Errorf ("%w: %s, %s" , ErrorValueConversion , value .Type ().Name (), configName )
190
+ return map [string ]string {}, fmt .Errorf ("%w: %s, %s" , ErrValueConversion , value .Type ().Name (), configName )
191
191
}
192
192
ret := map [string ]string {}
193
193
iter := subMap .MapRange ()
@@ -277,7 +277,7 @@ func GetShardSize() (int, error) {
277
277
// GetWebhookURL returns the webhook URL to ping on a successful cron job completion.
278
278
func GetWebhookURL () (string , error ) {
279
279
url , err := getStringConfigValue (webhookURL , configYAML , "WebhookURL" , "webhook-url" )
280
- if err != nil && ! errors .Is (err , ErrorEmptyConfigValue ) {
280
+ if err != nil && ! errors .Is (err , ErrEmptyConfigValue ) {
281
281
return url , err
282
282
}
283
283
return url , nil
@@ -327,7 +327,7 @@ func GetInputBucketPrefix() (string, error) {
327
327
if err != nil {
328
328
// TODO temporarily falling back to old variables until changes propagate to production
329
329
prefix , err := getStringConfigValue (inputBucketPrefix , configYAML , "InputBucketPrefix" , "input-bucket-prefix" )
330
- if err != nil && ! errors .Is (err , ErrorEmptyConfigValue ) {
330
+ if err != nil && ! errors .Is (err , ErrEmptyConfigValue ) {
331
331
return "" , err
332
332
}
333
333
return prefix , nil
0 commit comments