Skip to content

Commit b245cd7

Browse files
authored
fix lint new version (#2703)
1 parent c02687d commit b245cd7

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

internal/services/domain/types.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ func flattenDomainData(data string, recordType domain.RecordType) interface{} {
2323
}
2424

2525
func flattenDomainGeoIP(config *domain.RecordGeoIPConfig) interface{} {
26-
flattened := []map[string]interface{}{}
26+
flattenedResult := []map[string]interface{}{}
2727

2828
if config == nil {
29-
return flattened
29+
return flattenedResult
3030
}
3131

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 {
3435
matches := []map[string]interface{}{}
3536
for _, match := range config.Matches {
3637
rawMatch := map[string]interface{}{
@@ -42,13 +43,12 @@ func flattenDomainGeoIP(config *domain.RecordGeoIPConfig) interface{} {
4243
if len(match.Countries) > 0 {
4344
rawMatch["countries"] = match.Countries
4445
}
45-
4646
matches = append(matches, rawMatch)
4747
}
48-
flattened[0]["matches"] = matches
48+
flattenedResult[0]["matches"] = matches
4949
}
5050

51-
return flattened
51+
return flattenedResult
5252
}
5353

5454
func expandDomainGeoIPConfig(defaultData string, i interface{}, ok bool) *domain.RecordGeoIPConfig {
@@ -105,7 +105,7 @@ func flattenDomainHTTPService(config *domain.RecordHTTPServiceConfig) interface{
105105
}
106106

107107
ips := []interface{}{}
108-
if config.IPs != nil && len(config.IPs) > 0 {
108+
if len(config.IPs) > 0 {
109109
for _, ip := range config.IPs {
110110
ips = append(ips, ip.String())
111111
}
@@ -152,7 +152,7 @@ func flattenDomainWeighted(config *domain.RecordWeightedConfig) interface{} {
152152
return flattened
153153
}
154154

155-
if config.WeightedIPs != nil && len(config.WeightedIPs) > 0 {
155+
if len(config.WeightedIPs) > 0 {
156156
for _, weightedIPs := range config.WeightedIPs {
157157
flattened = append(flattened, map[string]interface{}{
158158
"ip": weightedIPs.IP.String(),
@@ -191,7 +191,7 @@ func flattenDomainView(config *domain.RecordViewConfig) interface{} {
191191
return flattened
192192
}
193193

194-
if config.Views != nil && len(config.Views) > 0 {
194+
if len(config.Views) > 0 {
195195
for _, view := range config.Views {
196196
flattened = append(flattened, map[string]interface{}{
197197
"subnet": view.Subnet,

internal/services/instance/helpers_instance.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,13 @@ func validateLocalVolumeSizes(volumes map[string]*instance.VolumeServerTemplate,
242242
}
243243

244244
if localVolumeTotalSize < volumeConstraint.MinSize || localVolumeTotalSize > volumeConstraint.MaxSize {
245-
min := humanize.Bytes(uint64(volumeConstraint.MinSize))
245+
minSize := humanize.Bytes(uint64(volumeConstraint.MinSize))
246246
if volumeConstraint.MinSize == volumeConstraint.MaxSize {
247-
return fmt.Errorf("%s total local volume size must be equal to %s", commercialType, min)
247+
return fmt.Errorf("%s total local volume size must be equal to %s", commercialType, minSize)
248248
}
249249

250-
max := humanize.Bytes(uint64(volumeConstraint.MaxSize))
251-
return fmt.Errorf("%s total local volume size must be between %s and %s", commercialType, min, max)
250+
maxSize := humanize.Bytes(uint64(volumeConstraint.MaxSize))
251+
return fmt.Errorf("%s total local volume size must be between %s and %s", commercialType, minSize, maxSize)
252252
}
253253

254254
return nil

internal/services/k8s/pool_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ func testAccCheckK8SPoolPublicIP(tt *acctest.TestTools, clusterTFName, poolTFNam
643643
if disabled == true && server.Server.PublicIPs != nil && len(server.Server.PublicIPs) > 0 {
644644
return errors.New("found node with public IP when none was expected")
645645
}
646-
if disabled == false && (server.Server.PublicIPs == nil || len(server.Server.PublicIPs) == 0) {
646+
if disabled == false && len(server.Server.PublicIPs) == 0 {
647647
return errors.New("found node with no public IP when one was expected")
648648
}
649649
}

0 commit comments

Comments
 (0)