refactor to use maps.Clone

pull/4942/head
cuiweixie 2025-08-17 21:00:15 +08:00
parent 14253afe2f
commit 51eb7da871
1 changed files with 2 additions and 5 deletions

View File

@ -16,6 +16,7 @@ package featuregate
import (
"fmt"
"maps"
"sort"
"strings"
"sync"
@ -92,11 +93,7 @@ type featureGate struct {
// NewFeatureGate creates a new feature gate with the default features
func NewFeatureGate() MutableFeatureGate {
known := map[Feature]FeatureSpec{}
for k, v := range defaultFeatures {
known[k] = v
}
known := maps.Clone(defaultFeatures)
f := &featureGate{}
f.known.Store(known)
f.enabled.Store(map[Feature]bool{})