@@ -23,14 +23,15 @@ func flattenDomainData(data string, recordType domain.RecordType) interface{} {
23
23
}
24
24
25
25
func flattenDomainGeoIP (config * domain.RecordGeoIPConfig ) interface {} {
26
- flattened := []map [string ]interface {}{}
26
+ flattenedResult := []map [string ]interface {}{}
27
27
28
28
if config == nil {
29
- return flattened
29
+ return flattenedResult
30
30
}
31
31
32
- flattened = []map [string ]interface {}{{}}
33
- if config .Matches != nil && len (config .Matches ) > 0 {
32
+ flattenedResult = []map [string ]interface {}{{}}
33
+
34
+ if len (config .Matches ) > 0 {
34
35
matches := []map [string ]interface {}{}
35
36
for _ , match := range config .Matches {
36
37
rawMatch := map [string ]interface {}{
@@ -42,13 +43,12 @@ func flattenDomainGeoIP(config *domain.RecordGeoIPConfig) interface{} {
42
43
if len (match .Countries ) > 0 {
43
44
rawMatch ["countries" ] = match .Countries
44
45
}
45
-
46
46
matches = append (matches , rawMatch )
47
47
}
48
- flattened [0 ]["matches" ] = matches
48
+ flattenedResult [0 ]["matches" ] = matches
49
49
}
50
50
51
- return flattened
51
+ return flattenedResult
52
52
}
53
53
54
54
func expandDomainGeoIPConfig (defaultData string , i interface {}, ok bool ) * domain.RecordGeoIPConfig {
@@ -105,7 +105,7 @@ func flattenDomainHTTPService(config *domain.RecordHTTPServiceConfig) interface{
105
105
}
106
106
107
107
ips := []interface {}{}
108
- if config . IPs != nil && len (config .IPs ) > 0 {
108
+ if len (config .IPs ) > 0 {
109
109
for _ , ip := range config .IPs {
110
110
ips = append (ips , ip .String ())
111
111
}
@@ -152,7 +152,7 @@ func flattenDomainWeighted(config *domain.RecordWeightedConfig) interface{} {
152
152
return flattened
153
153
}
154
154
155
- if config . WeightedIPs != nil && len (config .WeightedIPs ) > 0 {
155
+ if len (config .WeightedIPs ) > 0 {
156
156
for _ , weightedIPs := range config .WeightedIPs {
157
157
flattened = append (flattened , map [string ]interface {}{
158
158
"ip" : weightedIPs .IP .String (),
@@ -191,7 +191,7 @@ func flattenDomainView(config *domain.RecordViewConfig) interface{} {
191
191
return flattened
192
192
}
193
193
194
- if config . Views != nil && len (config .Views ) > 0 {
194
+ if len (config .Views ) > 0 {
195
195
for _ , view := range config .Views {
196
196
flattened = append (flattened , map [string ]interface {}{
197
197
"subnet" : view .Subnet ,
0 commit comments