diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..b8046be --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,60 @@ +run: + timeout: 3m + modules-download-mode: readonly + allow-parallel-runners: true + build-tags: + - docker + +linters: + enable: + - errname + - gofmt + - goimports + - stylecheck + - importas + - errcheck + - gosimple + - govet + - ineffassign + - mirror + - misspell + - staticcheck + - tagalign + - testifylint + - typecheck + - unused + - unconvert + - unparam + - wastedassign + - whitespace + - protogetter + # TODO enable https://github.com/openfga/openfga/issues/598 + # - bodyclose + # - contextcheck + # - exhaustive + # - errorlint + # - gochecknoglobals + # - gocritic + # - godot + # - gosec + # - noctx + # - inamedparam + # - perfsprint + # - prealloc + # - tparallel +linters-settings: + govet: + enable-all: true + disable: + - shadow + - fieldalignment + goimports: + local-prefixes: "github.com/openfga/openfga-contrib" + importas: + # Do not allow unaliased imports of aliased packages. + no-unaliased: true + # Do not allow non-required aliases. + no-extra-aliases: false + alias: + - pkg: github.com/openfga/api/proto/openfga/v1 + alias: openfgav1 diff --git a/middleware/authorizer/authorizer.go b/middleware/authorizer/authorizer.go index b35b576..d6c36da 100644 --- a/middleware/authorizer/authorizer.go +++ b/middleware/authorizer/authorizer.go @@ -10,7 +10,6 @@ import ( func UnaryServerInterceptor(authorizer Authorizer) grpc.UnaryServerInterceptor { return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { - storeIDGetter, ok := req.(FGAStoreIDGetter) if !ok { // no storeID diff --git a/plugins/middleware/main.go b/plugins/middleware/main.go index e5e88e2..562726f 100644 --- a/plugins/middleware/main.go +++ b/plugins/middleware/main.go @@ -6,9 +6,10 @@ import ( "google.golang.org/grpc" + "github.com/openfga/openfga/pkg/plugin" + "github.com/openfga/openfga-contrib/middleware/authorizer" "github.com/openfga/openfga-contrib/middleware/ratelimiter" - "github.com/openfga/openfga/pkg/plugin" ) type mockAuthorizer struct{} diff --git a/plugins/storage/sqlite/main.go b/plugins/storage/sqlite/main.go index 31df9fd..ddf79cf 100644 --- a/plugins/storage/sqlite/main.go +++ b/plugins/storage/sqlite/main.go @@ -1,8 +1,9 @@ package main import ( - "github.com/openfga/openfga-contrib/storage/sqlite" "github.com/openfga/openfga/pkg/plugin" + + "github.com/openfga/openfga-contrib/storage/sqlite" ) func InitPlugin(pm *plugin.PluginManager) error {