diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-22 13:13:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-22 13:13:50 +0200 |
commit | 3b52e4d0b5baacf5f63516c664a117a7537a075e (patch) | |
tree | ef6dc8150136e7941daf45a2e6b615dee43c7893 /pkg/hooks/exec | |
parent | d6b41eb393c154eaff79b4fdcb04c7510a6fdb20 (diff) | |
parent | db826d5d75630cca784bd7092eba5b06601ae27f (diff) | |
download | podman-3b52e4d0b5baacf5f63516c664a117a7537a075e.tar.gz podman-3b52e4d0b5baacf5f63516c664a117a7537a075e.tar.bz2 podman-3b52e4d0b5baacf5f63516c664a117a7537a075e.zip |
Merge pull request #3562 from baude/golangcilint3
golangci-lint round #3
Diffstat (limited to 'pkg/hooks/exec')
-rw-r--r-- | pkg/hooks/exec/runtimeconfigfilter.go | 12 |
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", |