Skip to content

Commit

Permalink
tune goimports linting (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
katbyte authored Jun 10, 2019
1 parent 2e0864b commit 1f58b34
Show file tree
Hide file tree
Showing 21 changed files with 31 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ linters:
linters-settings:
errcheck:
ignore: github.com/hashicorp/terraform/helper/schema:ForceNew|Set,fmt:.*,io:Close
misspell:
locale: UK

run:
modules-download-mode: vendor
4 changes: 2 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ fmt:
fmtcheck:
@sh "$(CURDIR)/scripts/gofmtcheck.sh"

goimport:
goimports:
@echo "==> Fixing imports code with goimports..."
goimports -w $(PKG_NAME)/
goimports -local "github.com/terraform-providers/terraform-provider-azuread/azuread" -w $(PKG_NAME)/

lint:
@echo "==> Checking source code against linters..."
Expand Down
3 changes: 2 additions & 1 deletion azuread/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
"github.com/hashicorp/go-azure-helpers/authentication"
"github.com/hashicorp/go-azure-helpers/sender"
"github.com/hashicorp/terraform/httpclient"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
"github.com/terraform-providers/terraform-provider-azuread/version"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
)

// ArmClient contains the handles to all the specific Azure ADger resource classes' respective clients.
Expand Down
1 change: 1 addition & 0 deletions azuread/data_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
"github.com/hashicorp/terraform/helper/schema"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate"
)
Expand Down
1 change: 1 addition & 0 deletions azuread/data_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
"github.com/hashicorp/terraform/helper/schema"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate"
)
Expand Down
2 changes: 1 addition & 1 deletion azuread/helpers/ar/response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type testNetError struct {
temporary bool
}

// testNetError fulfills net.Error interface
// testNetError fulfils net.Error interface
func (e testNetError) Error() string { return "testError" }
func (e testNetError) Timeout() bool { return e.timeout }
func (e testNetError) Temporary() bool { return e.temporary }
Expand Down
1 change: 1 addition & 0 deletions azuread/helpers/graph/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/p"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate"
)
Expand Down
1 change: 1 addition & 0 deletions azuread/helpers/graph/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/Azure/go-autorest/autorest"
"github.com/hashicorp/terraform/helper/resource"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
)

Expand Down
1 change: 1 addition & 0 deletions azuread/resource_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/p"
Expand Down
1 change: 1 addition & 0 deletions azuread/resource_application_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
"github.com/hashicorp/terraform/helper/schema"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/tf"
Expand Down
2 changes: 1 addition & 1 deletion azuread/resource_application_password_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func testCheckADApplicationPasswordExists(name string) resource.TestCheckFunc {
return nil
}

return fmt.Errorf("Password Credential %q was not found in Aplication %q", id.KeyId, id.ObjectId)
return fmt.Errorf("Password Credential %q was not found in Application %q", id.KeyId, id.ObjectId)
}
}

Expand Down
1 change: 1 addition & 0 deletions azuread/resource_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
)

Expand Down
3 changes: 2 additions & 1 deletion azuread/resource_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/p"
Expand Down Expand Up @@ -48,7 +49,7 @@ func resourceGroupCreate(d *schema.ResourceData, meta interface{}) error {
properties := graphrbac.GroupCreateParameters{
DisplayName: &name,
MailEnabled: p.Bool(false), // we're defaulting to false, as the API currently only supports the creation of non-mail enabled security groups.
MailNickname: p.String(uuid.New().String()), // this matches the portal behavior
MailNickname: p.String(uuid.New().String()), // this matches the portal behaviour
SecurityEnabled: p.Bool(true), // we're defaulting to true, as the API currently only supports the creation of non-mail enabled security groups.
}

Expand Down
1 change: 1 addition & 0 deletions azuread/resource_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
)

Expand Down
16 changes: 7 additions & 9 deletions azuread/resource_service_principal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import (
"fmt"
"log"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/tf"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate"

"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
"github.com/hashicorp/go-azure-helpers/response"
"github.com/hashicorp/terraform/helper/schema"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/p"

"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/tf"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate"
)

const servicePrincipalResourceName = "azuread_service_principal"
Expand Down Expand Up @@ -88,7 +86,7 @@ func resourceServicePrincipalCreate(d *schema.ResourceData, meta interface{}) er
return client.Get(ctx, *sp.ObjectID)
})
if err != nil {
return fmt.Errorf("Error waiting for Service Pricipal with ObjectId %q: %+v", *sp.ObjectID, err)
return fmt.Errorf("Error waiting for Service Principal with ObjectId %q: %+v", *sp.ObjectID, err)
}

return resourceServicePrincipalRead(d, meta)
Expand Down
1 change: 1 addition & 0 deletions azuread/resource_service_principal_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
"github.com/hashicorp/terraform/helper/schema"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/tf"
Expand Down
1 change: 1 addition & 0 deletions azuread/resource_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph"
"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/p"
Expand Down
1 change: 1 addition & 0 deletions azuread/resource_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"

"github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar"
)

Expand Down
2 changes: 1 addition & 1 deletion examples/service_principal/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## This example creates a basic application and Service Principal using the Azure Active Directory resources.
# WARNING: the service pricipal password will be presisted to state
# WARNING: the service Principal password will be presisted to state

#create a random identifier for the application name
resource "random_id" "app_name" {
Expand Down
2 changes: 1 addition & 1 deletion examples/service_principal/create-for-rbac/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## This example creates a basic application and Service Principal and then assigns a role
## this mimics the behaviour of `az ad sp create-for-rbac --years 2`

# WARNING: the service pricipal password will be presisted to state
# WARNING: the service principal password will be presisted to state

data "azurerm_subscription" "main" {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ if ($role -eq $null) {
$role = Get-AzureADDirectoryRole | Where-Object {$_.displayName -eq 'Company Administrator'}
}
$sp = Get-AzureADServicePrincipal | Where-Object {$_.displayName -eq 'Service Pricipal Name'}
$sp = Get-AzureADServicePrincipal | Where-Object {$_.displayName -eq 'Service Principal Name'}
$sp.ObjectId
Add-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $sp.ObjectId
Expand Down

0 comments on commit 1f58b34

Please sign in to comment.