Skip to content

Commit f5c5203

Browse files
authored
fix: set default list val instead nil (#19)
1 parent c7d7dbb commit f5c5203

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

internal/growthbook/feature.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ func (f *Feature) FromV1beta1(feature v1beta1.GrowthbookFeature) *Feature {
4646
f.Tags = feature.Spec.Tags
4747
f.DefaultValue = feature.Spec.DefaultValue
4848
f.ValueType = FeatureValueType(feature.Spec.ValueType)
49-
f.Environments = nil
49+
50+
if f.Environments == nil {
51+
f.Environments = []string{}
52+
}
53+
54+
if f.Tags == nil {
55+
f.Tags = []string{}
56+
}
5057

5158
f.EnvironmentSettings = make(map[string]EnvironmentSetting)
5259
for _, env := range feature.Spec.Environments {

internal/growthbook/sdkconnection.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ func (s *SDKConnection) FromV1beta1(client v1beta1.GrowthbookClient) *SDKConnect
3737
s.IncludeVisualExperiments = client.Spec.IncludeVisualExperiments
3838
s.IncludeDraftExperiments = client.Spec.IncludeDraftExperiments
3939
s.IncludeExperimentNames = client.Spec.IncludeExperimentNames
40+
41+
if s.Languages == nil {
42+
s.Languages = []string{}
43+
}
44+
4045
return s
4146
}
4247

0 commit comments

Comments
 (0)