diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-07-10 12:35:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-10 12:35:48 +0200 |
commit | 2ac8c6953481eb7391a6a7594709811f7ae3167f (patch) | |
tree | a72386000d844e7b9c6f1dd79bf5b77f63a45fd2 /libpod/runtime.go | |
parent | d9cd0032f7478e625329326d7593162a9f1e8c1e (diff) | |
parent | 4b784b377cea542228278f2ea501baa32b885be7 (diff) | |
download | podman-2ac8c6953481eb7391a6a7594709811f7ae3167f.tar.gz podman-2ac8c6953481eb7391a6a7594709811f7ae3167f.tar.bz2 podman-2ac8c6953481eb7391a6a7594709811f7ae3167f.zip |
Merge pull request #6917 from mheon/retErr_for_libpod
Remove all instances of named return "err" from Libpod
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 2575decc3..0075c0e13 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -126,7 +126,7 @@ func SetXdgDirs() error { // NewRuntime creates a new container runtime // Options can be passed to override the default configuration for the runtime -func NewRuntime(ctx context.Context, options ...RuntimeOption) (runtime *Runtime, err error) { +func NewRuntime(ctx context.Context, options ...RuntimeOption) (*Runtime, error) { conf, err := config.NewConfig("") if err != nil { return nil, err @@ -140,13 +140,13 @@ func NewRuntime(ctx context.Context, options ...RuntimeOption) (runtime *Runtime // functions can be used to mutate this configuration further. // An error will be returned if the configuration file at the given path does // not exist or cannot be loaded -func NewRuntimeFromConfig(ctx context.Context, userConfig *config.Config, options ...RuntimeOption) (runtime *Runtime, err error) { +func NewRuntimeFromConfig(ctx context.Context, userConfig *config.Config, options ...RuntimeOption) (*Runtime, error) { return newRuntimeFromConfig(ctx, userConfig, options...) } -func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...RuntimeOption) (runtime *Runtime, err error) { - runtime = new(Runtime) +func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...RuntimeOption) (*Runtime, error) { + runtime := new(Runtime) if conf.Engine.OCIRuntime == "" { conf.Engine.OCIRuntime = "runc" @@ -236,7 +236,7 @@ func getLockManager(runtime *Runtime) (lock.Manager, error) { // Make a new runtime based on the given configuration // Sets up containers/storage, state store, OCI runtime -func makeRuntime(ctx context.Context, runtime *Runtime) (err error) { +func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) { // Find a working conmon binary cPath, err := runtime.config.FindConmon() if err != nil { @@ -316,12 +316,11 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) { return err } defer func() { - if err != nil && store != nil { + if retErr != nil && store != nil { // Don't forcibly shut down // We could be opening a store in use by another libpod - _, err2 := store.Shutdown(false) - if err2 != nil { - logrus.Errorf("Error removing store for partially-created runtime: %s", err2) + if _, err := store.Shutdown(false); err != nil { + logrus.Errorf("Error removing store for partially-created runtime: %s", err) } } }() |