update golangci
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
2023-06-04 18:51:00 +03:00
parent e1dfdc28ff
commit 9f7cf38e93
21 changed files with 144 additions and 113 deletions

View File

@@ -13,10 +13,12 @@ import (
var _ config.Provider = (*Provider)(nil)
func New(data *ini.File) *Provider {
const nameParts = 2
return &Provider{
data: data,
resolve: func(ctx context.Context, key config.Key) (string, string) {
keys := strings.SplitN(key.Name, "/", 2)
keys := strings.SplitN(key.Name, "/", nameParts)
if len(keys) == 1 {
return "", keys[0]
}
@@ -46,12 +48,12 @@ func (p *Provider) Read(ctx context.Context, key config.Key) (config.Variable, e
iniSection, err := p.data.GetSection(section)
if err != nil {
return config.Variable{}, fmt.Errorf("%w: %s: %v", config.ErrVariableNotFound, p.Name(), err)
return config.Variable{}, fmt.Errorf("%w: %s: %w", config.ErrVariableNotFound, p.Name(), err)
}
iniKey, err := iniSection.GetKey(name)
if err != nil {
return config.Variable{}, fmt.Errorf("%w: %s: %v", config.ErrVariableNotFound, p.Name(), err)
return config.Variable{}, fmt.Errorf("%w: %s: %w", config.ErrVariableNotFound, p.Name(), err)
}
return config.Variable{