Skip to content

Commit

Permalink
Fix/shallowcopy (#12)
Browse files Browse the repository at this point in the history
* dispose nil check

* clear out stdout output

---------

Co-authored-by: Dawid Ciepiela <[email protected]>
  • Loading branch information
sarumaj and Dawid Ciepiela authored Oct 6, 2023
1 parent 818b22a commit 1a3701a
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions pkg/configfile/config_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,14 @@ func (conf Configuration) Copy() *Configuration {
SubDirectories: conf.SubDirectories,
Verbose: conf.Verbose,
Timeout: conf.Timeout,
Included: make([]string, len(conf.Included)),
Excluded: make([]string, len(conf.Excluded)),
Repositories: make(Repositories, len(conf.Repositories)),
}

if conf.Excluded != nil {
n.Excluded = make([]string, 0)
_ = copy(n.Excluded, conf.Excluded)
}

if conf.Included != nil {
n.Included = make([]string, 0)
_ = copy(n.Included, conf.Included)
}

if conf.Repositories != nil {
n.Repositories = make(Repositories, 0)
_ = copy(n.Repositories, conf.Repositories)
}
_ = copy(n.Excluded, conf.Excluded)
_ = copy(n.Included, conf.Included)
_ = copy(n.Repositories, conf.Repositories)

return n
}
Expand Down

0 comments on commit 1a3701a

Please sign in to comment.