mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-25 21:39:10 +00:00
Address singleCaseSwitch errors
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
f8870b31be
commit
2f48ab99c3
@ -146,8 +146,7 @@ func (c *configToml) setFlagToKeyValue(setFlag string) (string, interface{}, err
|
|||||||
if v == nil {
|
if v == nil {
|
||||||
return key, nil, errInvalidConfigOption
|
return key, nil, errInvalidConfigOption
|
||||||
}
|
}
|
||||||
switch v.(type) {
|
if _, ok := v.(bool); ok {
|
||||||
case bool:
|
|
||||||
if len(setParts) == 1 {
|
if len(setParts) == 1 {
|
||||||
return key, true, nil
|
return key, true, nil
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,7 @@ func (c *ConfigV1) AddRuntime(name string, path string, setAsDefault bool) error
|
|||||||
|
|
||||||
config.Set("version", int64(1))
|
config.Set("version", int64(1))
|
||||||
|
|
||||||
switch runc := config.GetPath([]string{"plugins", "cri", "containerd", "runtimes", "runc"}).(type) {
|
if runc, ok := config.GetPath([]string{"plugins", "cri", "containerd", "runtimes", "runc"}).(*toml.Tree); ok {
|
||||||
case *toml.Tree:
|
|
||||||
runc, _ = toml.Load(runc.String())
|
runc, _ = toml.Load(runc.String())
|
||||||
config.SetPath([]string{"plugins", "cri", "containerd", "runtimes", name}, runc)
|
config.SetPath([]string{"plugins", "cri", "containerd", "runtimes", name}, runc)
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,7 @@ func (c *Config) AddRuntime(name string, path string, setAsDefault bool) error {
|
|||||||
|
|
||||||
config.Set("version", int64(2))
|
config.Set("version", int64(2))
|
||||||
|
|
||||||
switch runc := config.GetPath([]string{"plugins", "io.containerd.grpc.v1.cri", "containerd", "runtimes", "runc"}).(type) {
|
if runc, ok := config.GetPath([]string{"plugins", "io.containerd.grpc.v1.cri", "containerd", "runtimes", "runc"}).(*toml.Tree); ok {
|
||||||
case *toml.Tree:
|
|
||||||
runc, _ = toml.Load(runc.String())
|
runc, _ = toml.Load(runc.String())
|
||||||
config.SetPath([]string{"plugins", "io.containerd.grpc.v1.cri", "containerd", "runtimes", name}, runc)
|
config.SetPath([]string{"plugins", "io.containerd.grpc.v1.cri", "containerd", "runtimes", name}, runc)
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,7 @@ func (c *Config) AddRuntime(name string, path string, setAsDefault bool) error {
|
|||||||
|
|
||||||
config := (toml.Tree)(*c)
|
config := (toml.Tree)(*c)
|
||||||
|
|
||||||
switch runc := config.Get("crio.runtime.runtimes.runc").(type) {
|
if runc, ok := config.Get("crio.runtime.runtimes.runc").(*toml.Tree); ok {
|
||||||
case *toml.Tree:
|
|
||||||
runc, _ = toml.Load(runc.String())
|
runc, _ = toml.Load(runc.String())
|
||||||
config.SetPath([]string{"crio", "runtime", "runtimes", name}, runc)
|
config.SetPath([]string{"crio", "runtime", "runtimes", name}, runc)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user