optimize code (#1694)
* fix something Signed-off-by: lijianxin <1430473452@qq.com>
This commit is contained in:
parent
224e0f6c6a
commit
b6ad96f105
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/helmfile/helmfile/pkg/runtime"
|
"github.com/helmfile/helmfile/pkg/runtime"
|
||||||
|
|
@ -34,7 +35,7 @@ func forbidEnvironmentsWithReleases(filePath string, content []byte) (bool, erro
|
||||||
result := []string{}
|
result := []string{}
|
||||||
resultKeys := map[string]interface{}{}
|
resultKeys := map[string]interface{}{}
|
||||||
for _, k := range topKeys {
|
for _, k := range topKeys {
|
||||||
if k == "environments" || k == "releases" || k == "---" {
|
if slices.Contains([]string{"environments", "releases", "---"}, k) {
|
||||||
if _, ok := resultKeys[k]; !ok {
|
if _, ok := resultKeys[k]; !ok {
|
||||||
result = append(result, k)
|
result = append(result, k)
|
||||||
if k != "---" {
|
if k != "---" {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue