Skip to content

Commit

Permalink
define slice in place
Browse files Browse the repository at this point in the history
  • Loading branch information
wkloucek committed Apr 26, 2022
1 parent 6aacbb4 commit bc2de7e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ocis-pkg/config/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ var (
// BindSourcesToStructs assigns any config value from a config file / env variable to struct `dst`. Its only purpose
// is to solely modify `dst`, not dealing with the config structs; and do so in a thread safe manner.
func BindSourcesToStructs(extension, ConfigFile string, failOnLoadErr bool, dst interface{}) (*gofig.Config, error) {
sources := []string{ConfigFile}
cnf := gofig.NewWithOptions(extension)
cnf.WithOptions(func(options *gofig.Options) {
options.DecoderConfig.TagName = decoderConfigTagName
})
cnf.AddDriver(gooyaml.Driver)

err := cnf.LoadFiles(sources...)
err := cnf.LoadFiles([]string{ConfigFile}...)
if err != nil && failOnLoadErr {
// fail only if config file was explicitly set
return nil, err
Expand Down

0 comments on commit bc2de7e

Please sign in to comment.