Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(all): linter error #2703

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions internal/services/domain/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ func flattenDomainData(data string, recordType domain.RecordType) interface{} {
}

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

if config == nil {
return flattened
return flattenedResult
}

flattened = []map[string]interface{}{{}}
if config.Matches != nil && len(config.Matches) > 0 {
flattenedResult = []map[string]interface{}{{}}

if len(config.Matches) > 0 {
matches := []map[string]interface{}{}
for _, match := range config.Matches {
rawMatch := map[string]interface{}{
Expand All @@ -42,13 +43,12 @@ func flattenDomainGeoIP(config *domain.RecordGeoIPConfig) interface{} {
if len(match.Countries) > 0 {
rawMatch["countries"] = match.Countries
}

matches = append(matches, rawMatch)
}
flattened[0]["matches"] = matches
flattenedResult[0]["matches"] = matches
}

return flattened
return flattenedResult
}

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

ips := []interface{}{}
if config.IPs != nil && len(config.IPs) > 0 {
if len(config.IPs) > 0 {
for _, ip := range config.IPs {
ips = append(ips, ip.String())
}
Expand Down Expand Up @@ -152,7 +152,7 @@ func flattenDomainWeighted(config *domain.RecordWeightedConfig) interface{} {
return flattened
}

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

if config.Views != nil && len(config.Views) > 0 {
if len(config.Views) > 0 {
for _, view := range config.Views {
flattened = append(flattened, map[string]interface{}{
"subnet": view.Subnet,
Expand Down
8 changes: 4 additions & 4 deletions internal/services/instance/helpers_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ func validateLocalVolumeSizes(volumes map[string]*instance.VolumeServerTemplate,
}

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

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

return nil
Expand Down
2 changes: 1 addition & 1 deletion internal/services/k8s/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ func testAccCheckK8SPoolPublicIP(tt *acctest.TestTools, clusterTFName, poolTFNam
if disabled == true && server.Server.PublicIPs != nil && len(server.Server.PublicIPs) > 0 {
return errors.New("found node with public IP when none was expected")
}
if disabled == false && (server.Server.PublicIPs == nil || len(server.Server.PublicIPs) == 0) {
if disabled == false && len(server.Server.PublicIPs) == 0 {
return errors.New("found node with no public IP when one was expected")
}
}
Expand Down
Loading