Skip to content

Commit

Permalink
Linting, fix up makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Aug 17, 2020
1 parent 0f6873f commit a6924cc
Show file tree
Hide file tree
Showing 25 changed files with 33 additions and 31 deletions.
4 changes: 2 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TEST?=$$(go list ./... |grep -v 'vendor')
WEBSITE_REPO=github.com/hashicorp/terraform-website
PKG_NAME=azuread
PKG_NAME=internal


.EXPORT_ALL_VARIABLES:
Expand Down Expand Up @@ -33,7 +33,7 @@ fmtcheck:

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

lint:
@echo "==> Checking source code against linters..."
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/U
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-azure-helpers v0.12.0 h1:7D0mFSyP3EfHu1ySubserIsnUWY87HMzzTWOB7ASwRU=
github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg=
github.com/hashicorp/go-azure-helpers v0.12.1-0.20200808010542-ac7d33a6436e h1:DNyIFEztN9Fik2I+1F5lTZvtrTNfMVZHWAHPFb0a0XA=
github.com/hashicorp/go-azure-helpers v0.12.1-0.20200808010542-ac7d33a6436e/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"log"
"time"

Expand All @@ -12,6 +11,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/tf"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func ApplicationCertificateResource() *schema.Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph_test

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"testing"
"time"

Expand All @@ -13,6 +12,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/acceptance"
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

const testCertificateApplication string = `-----BEGIN CERTIFICATE-----
Expand Down
2 changes: 1 addition & 1 deletion internal/services/aadgraph/application_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package aadgraph

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"

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

"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/tf"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"github.com/terraform-providers/terraform-provider-azuread/internal/validate"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"log"
"time"

Expand All @@ -12,6 +11,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/tf"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func ApplicationPasswordResource() *schema.Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph_test

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"testing"

"github.com/google/uuid"
Expand All @@ -12,6 +11,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/acceptance"
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func testCheckApplicationPasswordExists(name string) resource.TestCheckFunc { //nolint unparam
Expand Down
2 changes: 1 addition & 1 deletion internal/services/aadgraph/application_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph_test

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"regexp"
"testing"

Expand All @@ -13,6 +12,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/acceptance"
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/tf"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func TestAccApplication_basic(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/services/aadgraph/graph/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package graph

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"time"

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

"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func WaitForCreationReplication(f func() (interface{}, error)) (interface{}, error) {
Expand Down
3 changes: 2 additions & 1 deletion internal/services/aadgraph/graph/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package graph
import (
"context"
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"

"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"

"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func UserGetByObjectId(client *graphrbac.UsersClient, ctx context.Context, objectId string) (*graphrbac.User, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/services/aadgraph/group_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package aadgraph

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"

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

"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"github.com/terraform-providers/terraform-provider-azuread/internal/validate"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/services/aadgraph/group_member_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package aadgraph

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"

"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/tf"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"github.com/terraform-providers/terraform-provider-azuread/internal/validate"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/services/aadgraph/group_member_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph_test

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
Expand All @@ -13,6 +12,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/tf"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func TestAccGroupMember_user(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/services/aadgraph/group_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph_test

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"regexp"
"testing"

Expand All @@ -13,6 +12,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/acceptance"
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/tf"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func TestAccGroup_basic(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"log"
"time"

Expand All @@ -12,6 +11,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/tf"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func ServicePrincipalCertificateResource() *schema.Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph_test

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"testing"
"time"

Expand All @@ -13,6 +12,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/acceptance"
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

const testCertificateServicePrincipal string = `-----BEGIN CERTIFICATE-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package aadgraph

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"

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

"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"github.com/terraform-providers/terraform-provider-azuread/internal/validate"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"log"
"time"

Expand All @@ -12,6 +11,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/tf"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func ServicePrincipalPasswordResource() *schema.Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph_test

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"testing"

"github.com/google/uuid"
Expand All @@ -12,6 +11,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/acceptance"
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func testCheckServicePrincipalPasswordExists(name string) resource.TestCheckFunc { //nolint unparam
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph_test

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"testing"

"github.com/google/uuid"
Expand All @@ -11,6 +10,7 @@ import (

"github.com/terraform-providers/terraform-provider-azuread/internal/acceptance"
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func TestAccServicePrincipal_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/services/aadgraph/user_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package aadgraph

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"

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

"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"github.com/terraform-providers/terraform-provider-azuread/internal/validate"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/services/aadgraph/user_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aadgraph_test

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"strconv"
"testing"

Expand All @@ -13,6 +12,7 @@ import (
"github.com/terraform-providers/terraform-provider-azuread/internal/acceptance"
"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/tf"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
)

func TestAccUser_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/services/aadgraph/users_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
"crypto/sha1"
"encoding/base64"
"fmt"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"strings"

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

"github.com/terraform-providers/terraform-provider-azuread/internal/clients"
"github.com/terraform-providers/terraform-provider-azuread/internal/services/aadgraph/graph"
"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"github.com/terraform-providers/terraform-provider-azuread/internal/validate"
)

Expand Down
8 changes: 5 additions & 3 deletions internal/services/configure_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ package services

import (
"fmt"
"log"
"os"
"strings"

"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/hashicorp/go-azure-helpers/sender"
"github.com/hashicorp/terraform-plugin-sdk/meta"

"github.com/terraform-providers/terraform-provider-azuread/version"
"log"
"os"
"strings"
)

type ClientOptions struct {
Expand Down
6 changes: 3 additions & 3 deletions scripts/terrafmt-acctests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

echo "==> Checking acceptance test terraform blocks are formatted..."

files=$(find ./azuread -type f -name "*_test.go")
files=$(find ./internal -type f -name "*_test.go")
error=false

for f in $files; do
Expand All @@ -16,10 +16,10 @@ if ${error}; then
echo "You can fix this by running make tools and then terrafmt on them."
echo ""
echo "format a single file:"
echo "$ terrafmt fmt -f ./azuread/resource_user.go"
echo "$ terrafmt fmt -f ./internal/services/aadgraph/resource_user.go"
echo ""
echo "format all website files:"
echo "$ find azurerm | egrep \"_test.go\" | sort | while read f; do terrafmt fmt -f \$f; done"
echo "$ find ./internal | egrep \"_test.go\" | sort | while read f; do terrafmt fmt -f \$f; done"
echo ""
echo "on windows:"
echo "$ Get-ChildItem -Path . -Recurse -Filter \"*_test.go\" | foreach {terrafmt fmt -f $_.fullName}"
Expand Down

0 comments on commit a6924cc

Please sign in to comment.