Skip to content

Commit

Permalink
update to work with new static check
Browse files Browse the repository at this point in the history
  • Loading branch information
katbyte committed Jan 21, 2019
1 parent e2ba376 commit 73e5479
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .gometalinter.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
"gotype",
"ineffassign",
"interfacer",
"megacheck",
"nakedret",
"misspell",
"staticcheck",
"structcheck",
"unparam",
"unconvert",
"unused",
"varcheck",
"vet",
"vetshadow"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/helpers/suppress/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import (
)

func CaseDifference(_, old, new string, _ *schema.ResourceData) bool {
return strings.ToLower(old) == strings.ToLower(new)
return strings.EqualFold(old, new)
}
4 changes: 2 additions & 2 deletions azurerm/resource_arm_container_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ func resourceArmContainerRegistryCreate(d *schema.ResourceData, meta interface{}
}

if v, ok := d.GetOk("storage_account_id"); ok {
if strings.ToLower(sku) != strings.ToLower(string(containerregistry.Classic)) {
if !strings.EqualFold(sku, string(containerregistry.Classic)) {
return fmt.Errorf("`storage_account_id` can only be specified for a Classic (unmanaged) Sku.")
}

parameters.StorageAccount = &containerregistry.StorageAccountProperties{
ID: utils.String(v.(string)),
}
} else {
if strings.ToLower(sku) == strings.ToLower(string(containerregistry.Classic)) {
if strings.EqualFold(sku, string(containerregistry.Classic)) {
return fmt.Errorf("`storage_account_id` must be specified for a Classic (unmanaged) Sku.")
}
}
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_container_registry_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func findAzureStorageAccountIdFromName(name string, meta interface{}) (string, e
}

for _, account := range *accounts.Value {
if strings.ToLower(*account.Name) == strings.ToLower(name) {
if strings.EqualFold(*account.Name, name) {
return *account.ID, nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_container_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ func testCheckAzureRMContainerRegistryGeoreplications(resourceName string, sku s
expectedLocationsCount := len(expectedLocations) + 1 // the main location is returned by the API as a geolocation for replication.

// if Sku is not premium, listing the geo-replications locations returns an empty list
if strings.ToLower(sku) != strings.ToLower(string(containerregistry.Premium)) {
if !strings.EqualFold(sku, string(containerregistry.Premium)) {
expectedLocationsCount = 0
}

Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_servicebus_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func resourceArmServiceBusNamespace() *schema.Resource {
//so lets only allow it to be set if the SKU is premium
if _, ok := d.GetOk("capacity"); ok {
sku := d.Get("sku").(string)
if strings.ToLower(sku) != strings.ToLower(string(servicebus.Premium)) {
if strings.EqualFold(sku, string(servicebus.Premium)) {
return fmt.Errorf("`capacity` can only be set for a Premium SKU")
}
}
Expand Down
10 changes: 10 additions & 0 deletions staticcheck.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
checks = ["all", "-ST1000", "-ST1003", "-ST1005", "-ST1016"]
initialisms = ["ACL", "API", "ASCII", "CPU", "CSS", "DNS",
"EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID",
"IP", "JSON", "QPS", "RAM", "RPC", "SLA",
"SMTP", "SQL", "SSH", "TCP", "TLS", "TTL",
"UDP", "UI", "GID", "UID", "UUID", "URI",
"URL", "UTF8", "VM", "XML", "XMPP", "XSRF",
"XSS"]
dot_import_whitelist = []
http_status_code_whitelist = ["200", "400", "404", "500"]

0 comments on commit 73e5479

Please sign in to comment.