From d1830f9c8f2ef56dfeb590bf74dea78846045152 Mon Sep 17 00:00:00 2001 From: Sarah Funkhouser <11655165+sfunkhouser@users.noreply.github.com> Date: Wed, 11 Oct 2023 10:46:46 -0600 Subject: [PATCH] golangci fix local Signed-off-by: Sarah Funkhouser <11655165+sfunkhouser@users.noreply.github.com> --- .golangci.yaml | 2 +- cmd/createrole.go | 5 +++-- cmd/schema_mermaid.go | 3 ++- internal/api/assignments.go | 3 ++- internal/api/permissions.go | 5 +++-- internal/api/router.go | 5 +++-- internal/iapl/policy.go | 1 + internal/iapl/policy_test.go | 1 + internal/pubsub/subscriber.go | 5 +++-- internal/pubsub/subscriber_test.go | 7 ++++--- internal/query/relations.go | 3 ++- internal/query/relations_test.go | 3 ++- internal/query/roles.go | 3 ++- pkg/permissions/mockpermissions/permissions.go | 3 ++- pkg/permissions/mockpermissions/permissions_test.go | 5 +++-- pkg/permissions/permissions_test.go | 3 ++- pkg/permissions/relationships_test.go | 3 ++- 17 files changed, 38 insertions(+), 22 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 52bec3a5..bbc4be7e 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -6,7 +6,7 @@ run: linters-settings: goimports: - local-prefixes: go.hollow.sh/serverservice + local-prefixes: go.infratographer.com/permissions-api gofumpt: extra-rules: true diff --git a/cmd/createrole.go b/cmd/createrole.go index 8dc22ed8..8c266caa 100644 --- a/cmd/createrole.go +++ b/cmd/createrole.go @@ -5,12 +5,13 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + "go.infratographer.com/x/gidx" + "go.infratographer.com/x/viperx" + "go.infratographer.com/permissions-api/internal/config" "go.infratographer.com/permissions-api/internal/iapl" "go.infratographer.com/permissions-api/internal/query" "go.infratographer.com/permissions-api/internal/spicedbx" - "go.infratographer.com/x/gidx" - "go.infratographer.com/x/viperx" ) const ( diff --git a/cmd/schema_mermaid.go b/cmd/schema_mermaid.go index b4de914a..8b20711e 100644 --- a/cmd/schema_mermaid.go +++ b/cmd/schema_mermaid.go @@ -6,8 +6,9 @@ import ( "os" "text/template" - "go.infratographer.com/permissions-api/internal/iapl" "gopkg.in/yaml.v3" + + "go.infratographer.com/permissions-api/internal/iapl" ) var ( diff --git a/internal/api/assignments.go b/internal/api/assignments.go index 7cac3efa..24330a79 100644 --- a/internal/api/assignments.go +++ b/internal/api/assignments.go @@ -3,9 +3,10 @@ package api import ( "net/http" - "go.infratographer.com/permissions-api/internal/types" "go.infratographer.com/x/gidx" + "go.infratographer.com/permissions-api/internal/types" + "github.com/labstack/echo/v4" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" diff --git a/internal/api/permissions.go b/internal/api/permissions.go index c2fc4d81..1be231a9 100644 --- a/internal/api/permissions.go +++ b/internal/api/permissions.go @@ -8,11 +8,12 @@ import ( "time" "github.com/labstack/echo/v4" - "go.infratographer.com/permissions-api/internal/query" - "go.infratographer.com/permissions-api/internal/types" "go.infratographer.com/x/gidx" "go.opentelemetry.io/otel/codes" "go.uber.org/multierr" + + "go.infratographer.com/permissions-api/internal/query" + "go.infratographer.com/permissions-api/internal/types" ) const ( diff --git a/internal/api/router.go b/internal/api/router.go index e5b869f5..2594c2b9 100644 --- a/internal/api/router.go +++ b/internal/api/router.go @@ -5,12 +5,13 @@ import ( "net/http" "github.com/labstack/echo/v4" - "go.infratographer.com/permissions-api/internal/query" - "go.infratographer.com/permissions-api/internal/types" "go.infratographer.com/x/echojwtx" "go.infratographer.com/x/gidx" "go.opentelemetry.io/otel" "go.uber.org/zap" + + "go.infratographer.com/permissions-api/internal/query" + "go.infratographer.com/permissions-api/internal/types" ) var tracer = otel.Tracer("go.infratographer.com/permissions-api/internal/api") diff --git a/internal/iapl/policy.go b/internal/iapl/policy.go index f1643e28..9cdaa7dc 100644 --- a/internal/iapl/policy.go +++ b/internal/iapl/policy.go @@ -5,6 +5,7 @@ import ( "os" "go.infratographer.com/permissions-api/internal/types" + "gopkg.in/yaml.v3" ) diff --git a/internal/iapl/policy_test.go b/internal/iapl/policy_test.go index 4dfd21fb..e01b6121 100644 --- a/internal/iapl/policy_test.go +++ b/internal/iapl/policy_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.infratographer.com/permissions-api/internal/testingx" ) diff --git a/internal/pubsub/subscriber.go b/internal/pubsub/subscriber.go index dc74f9d7..b1fedc60 100644 --- a/internal/pubsub/subscriber.go +++ b/internal/pubsub/subscriber.go @@ -7,8 +7,6 @@ import ( "sync" "time" - "go.infratographer.com/permissions-api/internal/query" - "go.infratographer.com/permissions-api/internal/types" "go.infratographer.com/x/events" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" @@ -16,6 +14,9 @@ import ( "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" "go.uber.org/zap" + + "go.infratographer.com/permissions-api/internal/query" + "go.infratographer.com/permissions-api/internal/types" ) const nakDelay = 10 * time.Second diff --git a/internal/pubsub/subscriber_test.go b/internal/pubsub/subscriber_test.go index 8ce35c53..174a013b 100644 --- a/internal/pubsub/subscriber_test.go +++ b/internal/pubsub/subscriber_test.go @@ -6,13 +6,14 @@ import ( "testing" "time" - "go.infratographer.com/permissions-api/internal/query" - "go.infratographer.com/permissions-api/internal/query/mock" - "go.infratographer.com/permissions-api/internal/testingx" "go.infratographer.com/x/events" "go.infratographer.com/x/gidx" "go.infratographer.com/x/testing/eventtools" + "go.infratographer.com/permissions-api/internal/query" + "go.infratographer.com/permissions-api/internal/query/mock" + "go.infratographer.com/permissions-api/internal/testingx" + "github.com/stretchr/testify/require" ) diff --git a/internal/query/relations.go b/internal/query/relations.go index 0181444c..af5e51f0 100644 --- a/internal/query/relations.go +++ b/internal/query/relations.go @@ -8,12 +8,13 @@ import ( "strings" pb "github.com/authzed/authzed-go/proto/authzed/api/v1" - "go.infratographer.com/permissions-api/internal/types" "go.infratographer.com/x/gidx" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" + + "go.infratographer.com/permissions-api/internal/types" ) var roleSubjectRelation = "subject" diff --git a/internal/query/relations_test.go b/internal/query/relations_test.go index c844d40f..57f53457 100644 --- a/internal/query/relations_test.go +++ b/internal/query/relations_test.go @@ -9,11 +9,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.infratographer.com/x/gidx" + "go.infratographer.com/permissions-api/internal/iapl" "go.infratographer.com/permissions-api/internal/spicedbx" "go.infratographer.com/permissions-api/internal/testingx" "go.infratographer.com/permissions-api/internal/types" - "go.infratographer.com/x/gidx" ) func testEngine(ctx context.Context, t *testing.T, namespace string) Engine { diff --git a/internal/query/roles.go b/internal/query/roles.go index 13ae969d..6d19254d 100644 --- a/internal/query/roles.go +++ b/internal/query/roles.go @@ -1,8 +1,9 @@ package query import ( - "go.infratographer.com/permissions-api/internal/types" "go.infratographer.com/x/gidx" + + "go.infratographer.com/permissions-api/internal/types" ) const ( diff --git a/pkg/permissions/mockpermissions/permissions.go b/pkg/permissions/mockpermissions/permissions.go index 7bb455eb..127b7a53 100644 --- a/pkg/permissions/mockpermissions/permissions.go +++ b/pkg/permissions/mockpermissions/permissions.go @@ -6,9 +6,10 @@ import ( "context" "github.com/stretchr/testify/mock" - "go.infratographer.com/permissions-api/pkg/permissions" "go.infratographer.com/x/events" "go.infratographer.com/x/gidx" + + "go.infratographer.com/permissions-api/pkg/permissions" ) var _ permissions.AuthRelationshipRequestHandler = (*MockPermissions)(nil) diff --git a/pkg/permissions/mockpermissions/permissions_test.go b/pkg/permissions/mockpermissions/permissions_test.go index cfcea1de..d30b0f82 100644 --- a/pkg/permissions/mockpermissions/permissions_test.go +++ b/pkg/permissions/mockpermissions/permissions_test.go @@ -5,10 +5,11 @@ import ( "testing" "github.com/stretchr/testify/require" - "go.infratographer.com/permissions-api/pkg/permissions" - "go.infratographer.com/permissions-api/pkg/permissions/mockpermissions" "go.infratographer.com/x/events" "go.infratographer.com/x/gidx" + + "go.infratographer.com/permissions-api/pkg/permissions" + "go.infratographer.com/permissions-api/pkg/permissions/mockpermissions" ) func TestPermissions(t *testing.T) { diff --git a/pkg/permissions/permissions_test.go b/pkg/permissions/permissions_test.go index 90949920..0867d0a1 100644 --- a/pkg/permissions/permissions_test.go +++ b/pkg/permissions/permissions_test.go @@ -8,9 +8,10 @@ import ( "github.com/labstack/echo/v4" "github.com/stretchr/testify/require" - "go.infratographer.com/permissions-api/pkg/permissions" "go.infratographer.com/x/echojwtx" "go.infratographer.com/x/gidx" + + "go.infratographer.com/permissions-api/pkg/permissions" ) func TestPermissions(t *testing.T) { diff --git a/pkg/permissions/relationships_test.go b/pkg/permissions/relationships_test.go index 75cd6a12..abc69e20 100644 --- a/pkg/permissions/relationships_test.go +++ b/pkg/permissions/relationships_test.go @@ -8,10 +8,11 @@ import ( "github.com/labstack/echo/v4" "github.com/stretchr/testify/require" - "go.infratographer.com/permissions-api/pkg/permissions" "go.infratographer.com/x/events" "go.infratographer.com/x/gidx" "go.infratographer.com/x/testing/eventtools" + + "go.infratographer.com/permissions-api/pkg/permissions" ) func TestMiddlewareMissing(t *testing.T) {