mirror of https://github.com/fatedier/frp
refactor to use maps.Clone
parent
14253afe2f
commit
51eb7da871
|
@ -16,6 +16,7 @@ package featuregate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"maps"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -92,11 +93,7 @@ type featureGate struct {
|
||||||
|
|
||||||
// NewFeatureGate creates a new feature gate with the default features
|
// NewFeatureGate creates a new feature gate with the default features
|
||||||
func NewFeatureGate() MutableFeatureGate {
|
func NewFeatureGate() MutableFeatureGate {
|
||||||
known := map[Feature]FeatureSpec{}
|
known := maps.Clone(defaultFeatures)
|
||||||
for k, v := range defaultFeatures {
|
|
||||||
known[k] = v
|
|
||||||
}
|
|
||||||
|
|
||||||
f := &featureGate{}
|
f := &featureGate{}
|
||||||
f.known.Store(known)
|
f.known.Store(known)
|
||||||
f.enabled.Store(map[Feature]bool{})
|
f.enabled.Store(map[Feature]bool{})
|
||||||
|
|
Loading…
Reference in New Issue