summaryrefslogtreecommitdiff
path: root/pkg/hooks/exec
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-07-11 05:44:12 -0500
committerbaude <bbaude@redhat.com>2019-07-21 14:22:39 -0500
commitdb826d5d75630cca784bd7092eba5b06601ae27f (patch)
treec60cc844e499d5d57752fdb92d4036ea0487ae3c /pkg/hooks/exec
parenta5aa44c583612e210cf2ba44c3313a2ff27c94da (diff)
downloadpodman-db826d5d75630cca784bd7092eba5b06601ae27f.tar.gz
podman-db826d5d75630cca784bd7092eba5b06601ae27f.tar.bz2
podman-db826d5d75630cca784bd7092eba5b06601ae27f.zip
golangci-lint round #3
this is the third round of preparing to use the golangci-lint on our code base. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/hooks/exec')
-rw-r--r--pkg/hooks/exec/runtimeconfigfilter.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/pkg/hooks/exec/runtimeconfigfilter.go b/pkg/hooks/exec/runtimeconfigfilter.go
index c6971f680..10b8fedc2 100644
--- a/pkg/hooks/exec/runtimeconfigfilter.go
+++ b/pkg/hooks/exec/runtimeconfigfilter.go
@@ -27,7 +27,11 @@ var spewConfig = spew.ConfigState{
// reads back a possibly-altered form from their standard output).
func RuntimeConfigFilter(ctx context.Context, hooks []spec.Hook, config *spec.Spec, postKillTimeout time.Duration) (hookErr, err error) {
data, err := json.Marshal(config)
+ if err != nil {
+ return nil, err
+ }
for i, hook := range hooks {
+ hook := hook
var stdout bytes.Buffer
hookErr, err = Run(ctx, &hook, data, &stdout, nil, postKillTimeout)
if err != nil {
@@ -43,11 +47,11 @@ func RuntimeConfigFilter(ctx context.Context, hooks []spec.Hook, config *spec.Sp
}
if !reflect.DeepEqual(config, &newConfig) {
- old := spewConfig.Sdump(config)
- new := spewConfig.Sdump(&newConfig)
+ oldConfig := spewConfig.Sdump(config)
+ newConfig := spewConfig.Sdump(&newConfig)
diff, err := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{
- A: difflib.SplitLines(old),
- B: difflib.SplitLines(new),
+ A: difflib.SplitLines(oldConfig),
+ B: difflib.SplitLines(newConfig),
FromFile: "Old",
FromDate: "",
ToFile: "New",