From f011909bb7176b488e6dfb08658de0e83fa86875 Mon Sep 17 00:00:00 2001 From: Ufuk Date: Thu, 31 Oct 2024 17:14:45 +0300 Subject: [PATCH] chore: format --- internal/engines/check.go | 2 -- internal/engines/expand.go | 1 - internal/engines/subjectFilter.go | 1 - internal/storage/postgres/tenantWriter.go | 1 - pkg/cmd/serve.go | 1 - pkg/database/postgres/postgres.go | 1 - 6 files changed, 7 deletions(-) diff --git a/internal/engines/check.go b/internal/engines/check.go index c0ef88295..39e514843 100644 --- a/internal/engines/check.go +++ b/internal/engines/check.go @@ -276,7 +276,6 @@ func (engine *CheckEngine) checkDirectRelation(request *base.PermissionCheckRequ // TupleFilter helps in filtering out the relationships for a specific entity and a permission. var rit *database.TupleIterator rit, err = engine.dataReader.QueryRelationships(ctx, request.GetTenantId(), filter, request.GetMetadata().GetSnapToken(), database.NewCursorPagination()) - // If there's an error in querying, return a denied permission response along with the error. if err != nil { return denied(emptyResponseMetadata()), err @@ -466,7 +465,6 @@ func (engine *CheckEngine) checkDirectAttribute( // storageContext.NewContextualAttributes creates a new instance of ContextualAttributes based on the attributes // retrieved from the request context. val, err = storageContext.NewContextualAttributes(request.GetContext().GetAttributes()...).QuerySingleAttribute(filter) - // An error occurred while querying the single attribute, so we return a denied response with empty metadata // and the error. if err != nil { diff --git a/internal/engines/expand.go b/internal/engines/expand.go index ac85791ea..e68c4a7b7 100644 --- a/internal/engines/expand.go +++ b/internal/engines/expand.go @@ -487,7 +487,6 @@ func (engine *ExpandEngine) expandDirectAttribute( // Attempt to get the attribute using the defined filter. val, err = storageContext.NewContextualAttributes(request.GetContext().GetAttributes()...).QuerySingleAttribute(filter) - // If there's an error in getting the attribute, send a failure response through the channel and return from the function. if err != nil { expandChan <- expandFailResponse(err) diff --git a/internal/engines/subjectFilter.go b/internal/engines/subjectFilter.go index 16ebef2cb..e814807b6 100644 --- a/internal/engines/subjectFilter.go +++ b/internal/engines/subjectFilter.go @@ -248,7 +248,6 @@ func (engine *SubjectFilter) subjectFilterDirectAttribute( // storageContext.NewContextualAttributes creates a new instance of ContextualAttributes based on the attributes // retrieved from the request context. val, err = storageContext.NewContextualAttributes(request.GetContext().GetAttributes()...).QuerySingleAttribute(filter) - // An error occurred while querying the single attribute, so we return a denied response with empty metadata // and the error. if err != nil { diff --git a/internal/storage/postgres/tenantWriter.go b/internal/storage/postgres/tenantWriter.go index 1dbf9093d..4c82c4032 100644 --- a/internal/storage/postgres/tenantWriter.go +++ b/internal/storage/postgres/tenantWriter.go @@ -110,7 +110,6 @@ func (w *TenantWriter) DeleteTenant(ctx context.Context, tenantID string) (resul var name string var createdAt time.Time err = br.QueryRow().Scan(&name, &createdAt) - if err != nil { if totalDeleted > 0 { name = fmt.Sprintf("Affected rows: %d", totalDeleted) diff --git a/pkg/cmd/serve.go b/pkg/cmd/serve.go index e1513e509..7b6fc3da6 100644 --- a/pkg/cmd/serve.go +++ b/pkg/cmd/serve.go @@ -349,7 +349,6 @@ func serve() func(cmd *cobra.Command, args []string) error { headers, cfg.Meter.Protocol, ) - if err != nil { slog.Error(err.Error()) } diff --git a/pkg/database/postgres/postgres.go b/pkg/database/postgres/postgres.go index 7df0a0ec8..7cd4ff53d 100644 --- a/pkg/database/postgres/postgres.go +++ b/pkg/database/postgres/postgres.go @@ -248,7 +248,6 @@ func createPools(ctx context.Context, wConfig, rConfig *pgxpool.Config) (*pgxpoo } return nil }, retryPolicy) - // Handle errors from pinging if err != nil { writePool.Close()