@@ -44,11 +44,6 @@ type AmplitudeConfig struct {
44
44
FlagConfigPollerRequestTimeout time.Duration
45
45
}
46
46
47
- type AmplitudeVariant struct {
48
- Value string `json:"value,omitempty"`
49
- Payload interface {} `json:"payload,omitempty"`
50
- }
51
-
52
47
func init () {
53
48
err := godotenv .Load ()
54
49
if err != nil {
@@ -123,11 +118,8 @@ func fetch(user UserProperties) (*local.EvaluationResult, error) {
123
118
}
124
119
125
120
func getValue (flagName string , user UserProperties ) local.EvaluationVariant {
126
- result , err := fetch (user )
127
- if err != nil {
128
- fmt .Errorf ("error in fetch: %s" , err .Error ())
129
- }
130
- if result != nil {
121
+ result , _ := fetch (user )
122
+ if * result != nil {
131
123
if value , ok := (* result )[flagName ]; ok {
132
124
return value .Variant
133
125
}
@@ -137,15 +129,14 @@ func getValue(flagName string, user UserProperties) local.EvaluationVariant {
137
129
138
130
func getMapOfValue (user UserProperties ) map [string ]interface {} {
139
131
flags := make (map [string ]interface {})
140
- result , err := fetch (user )
141
- if err != nil {
142
- fmt . Errorf ( "error in fetch: %s" , err . Error ())
143
- }
144
- for k , v := range * result {
145
- if v . IsDefaultVariant {
146
- continue
132
+ result , _ := fetch (user )
133
+ if * result != nil {
134
+ for k , v := range * result {
135
+ if v . IsDefaultVariant {
136
+ continue
137
+ }
138
+ flags [ k ] = v . Variant . Key
147
139
}
148
- flags [k ] = v .Variant .Key
149
140
}
150
141
return flags
151
142
}
0 commit comments