mirror of
https://github.com/containers/podman.git
synced 2025-09-16 14:17:38 +08:00
inline some conditionals
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -445,7 +445,6 @@ func configHook() {
|
||||
}
|
||||
|
||||
func loggingHook() {
|
||||
var found bool
|
||||
if debug {
|
||||
if logLevel != defaultLogLevel {
|
||||
fmt.Fprintf(os.Stderr, "Setting --log-level and --debug is not allowed\n")
|
||||
@ -453,10 +452,8 @@ func loggingHook() {
|
||||
}
|
||||
logLevel = "debug"
|
||||
}
|
||||
if slices.Contains(common.LogLevels, strings.ToLower(logLevel)) {
|
||||
found = true
|
||||
}
|
||||
if !found {
|
||||
|
||||
if !slices.Contains(common.LogLevels, strings.ToLower(logLevel)) {
|
||||
fmt.Fprintf(os.Stderr, "Log Level %q is not supported, choose from: %s\n", logLevel, strings.Join(common.LogLevels, ", "))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -131,8 +131,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
|
||||
// Only include anonymous named volumes added by the user by
|
||||
// default.
|
||||
for _, v := range c.config.NamedVolumes {
|
||||
include := slices.Contains(c.config.UserVolumes, v.Dest)
|
||||
if include {
|
||||
if slices.Contains(c.config.UserVolumes, v.Dest) {
|
||||
vol, err := c.runtime.GetVolume(v.Name)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("volume %s used in container %s has been removed: %w", v.Name, c.ID(), err)
|
||||
|
@ -107,9 +107,7 @@ func validatePlugin(newPlugin *VolumePlugin) error {
|
||||
return fmt.Errorf("unmarshalling plugin %s activation response: %w", newPlugin.Name, err)
|
||||
}
|
||||
|
||||
foundVolume := slices.Contains(respStruct.Implements, volumePluginType)
|
||||
|
||||
if !foundVolume {
|
||||
if !slices.Contains(respStruct.Implements, volumePluginType) {
|
||||
return fmt.Errorf("plugin %s does not implement volume plugin, instead provides %s: %w", newPlugin.Name, strings.Join(respStruct.Implements, ", "), ErrNotVolumePlugin)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user