Skip to content

Commit

Permalink
remove unused error return value
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <[email protected]>
  • Loading branch information
yurishkuro committed Aug 25, 2024
1 parent f250270 commit 4d741e7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions confmap/provider/envprovider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ func (emp *provider) Retrieve(_ context.Context, uri string, _ confmap.WatcherFu
if !strings.HasPrefix(uri, schemeName+":") {
return nil, fmt.Errorf("%q uri is not supported by %q provider", uri, schemeName)
}
envVarName, defaultValuePtr, err := parseEnvVarURI(uri[len(schemeName)+1:])
if err != nil {
return nil, err
}
envVarName, defaultValuePtr := parseEnvVarURI(uri[len(schemeName)+1:])
if !envvar.ValidationRegexp.MatchString(envVarName) {
return nil, fmt.Errorf("environment variable %q has invalid name: must match regex %s", envVarName, envvar.ValidationPattern)
}
Expand All @@ -76,12 +73,12 @@ func (*provider) Shutdown(context.Context) error {
return nil
}

// returns (var name, default value, parse error)
func parseEnvVarURI(uri string) (string, *string, error) {
// returns (var name, default value)
func parseEnvVarURI(uri string) (string, *string) {
const defaultSuffix = ":-"
if strings.Contains(uri, defaultSuffix) {
parts := strings.SplitN(uri, defaultSuffix, 2)
return parts[0], &parts[1], nil
return parts[0], &parts[1]
}
return uri, nil, nil
return uri, nil
}

0 comments on commit 4d741e7

Please sign in to comment.