fix lint - drop else block

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2020-01-08 13:57:54 +01:00
parent baba52c6b5
commit 0b53ff2902
4 changed files with 40 additions and 37 deletions

View File

@ -451,9 +451,11 @@ func NewConfig(userConfigPath string) (*Config, error) {
}
// Now, check if the user can access system configs and merge them if needed.
if configs, err := systemConfigs(); err != nil {
configs, err := systemConfigs()
if err != nil {
return nil, errors.Wrapf(err, "error finding config on system")
} else {
}
migrated := false
for _, path := range configs {
systemConfig, err := readConfigFromFile(path)
@ -476,21 +478,21 @@ func NewConfig(userConfigPath string) (*Config, error) {
}
logrus.Debugf("Merged system config %q: %v", path, config)
}
}
// Finally, create a default config from memory and forcefully merge it into
// the config. This way we try to make sure that all fields are properly set
// and that user AND system config can partially set.
if defaultConfig, err := defaultConfigFromMemory(); err != nil {
defaultConfig, err := defaultConfigFromMemory()
if err != nil {
return nil, errors.Wrapf(err, "error generating default config from memory")
} else {
}
// Check if we need to switch to cgroupfs and logger=file on rootless.
defaultConfig.checkCgroupsAndLogger()
if err := config.mergeConfig(defaultConfig); err != nil {
return nil, errors.Wrapf(err, "error merging default config from memory")
}
}
// Relative paths can cause nasty bugs, because core paths we use could
// shift between runs (or even parts of the program - the OCI runtime

View File

@ -26,11 +26,12 @@ const (
// config is different for root and rootless. It also parses the storage.conf.
func defaultConfigFromMemory() (*Config, error) {
c := new(Config)
if tmp, err := defaultTmpDir(); err != nil {
tmp, err := defaultTmpDir()
if err != nil {
return nil, err
} else {
c.TmpDir = tmp
}
c.TmpDir = tmp
c.EventsLogFilePath = filepath.Join(c.TmpDir, "events", "events.log")
storeOpts, err := storage.DefaultStoreOptions(rootless.IsRootless(), rootless.GetRootlessUID())

View File

@ -213,11 +213,11 @@ func getLockManager(runtime *Runtime) (lock.Manager, error) {
// Sets up containers/storage, state store, OCI runtime
func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
// Find a working conmon binary
if cPath, err := runtime.config.FindConmon(); err != nil {
cPath, err := runtime.config.FindConmon()
if err != nil {
return err
} else {
runtime.conmonPath = cPath
}
runtime.conmonPath = cPath
// Make the static files directory if it does not exist
if err := os.MkdirAll(runtime.config.StaticDir, 0700); err != nil {