mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 08:20:59 +00:00
fix: correct lint issues
This commit is contained in:
@@ -59,20 +59,20 @@ func (o *removeConfigMapOptions) Validate(args []string) error {
|
||||
func (o *removeConfigMapOptions) RunRemoveConfigMap(fSys filesys.FileSystem) error {
|
||||
mf, err := kustfile.NewKustomizationFile(fSys)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("configmap cannot load from file system, got %w", err)
|
||||
}
|
||||
|
||||
m, err := mf.Read()
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("configmap cannot read from file, got %w", err)
|
||||
}
|
||||
|
||||
var newConfigMaps []types.ConfigMapArgs
|
||||
foundConfigMaps := make(map[string]bool)
|
||||
for _, removeName := range o.configMapNames {
|
||||
foundConfigMaps[removeName] = false
|
||||
}
|
||||
|
||||
newConfigMaps := make([]types.ConfigMapArgs, 0, len(m.ConfigMapGenerator))
|
||||
for _, currentConfigMap := range m.ConfigMapGenerator {
|
||||
if kustfile.StringInSlice(currentConfigMap.Name, o.configMapNames) {
|
||||
foundConfigMaps[currentConfigMap.Name] = true
|
||||
@@ -88,5 +88,9 @@ func (o *removeConfigMapOptions) RunRemoveConfigMap(fSys filesys.FileSystem) err
|
||||
}
|
||||
|
||||
m.ConfigMapGenerator = newConfigMaps
|
||||
return mf.Write(m)
|
||||
err = mf.Write(m)
|
||||
if err != nil {
|
||||
return fmt.Errorf("configmap cannot write back to file, got %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package remove
|
||||
package remove //nolint:testpackage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
Reference in New Issue
Block a user