From 1a3701a1c5863a903eb131e829eccada93e6a6dc Mon Sep 17 00:00:00 2001 From: Dawid Ciepiela <71898979+sarumaj@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:38:45 +0200 Subject: [PATCH] Fix/shallowcopy (#12) * dispose nil check * clear out stdout output --------- Co-authored-by: Dawid Ciepiela --- pkg/configfile/config_file.go | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/pkg/configfile/config_file.go b/pkg/configfile/config_file.go index 35d0826..74dd719 100644 --- a/pkg/configfile/config_file.go +++ b/pkg/configfile/config_file.go @@ -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 }