From 455e4c72f23fcaf76e39b7e232845ecfaf9b208c Mon Sep 17 00:00:00 2001 From: Ishan Arya Date: Tue, 18 Jun 2024 19:53:51 +0530 Subject: [PATCH] lint: format --- core/servicedata/service.go | 3 +-- core/servicedata/service_test.go | 2 +- internal/api/v1beta1/group.go | 12 +++++++----- internal/api/v1beta1/mocks/relation_service.go | 1 - internal/api/v1beta1/user.go | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/servicedata/service.go b/core/servicedata/service.go index 67c913868..027433f4f 100644 --- a/core/servicedata/service.go +++ b/core/servicedata/service.go @@ -14,9 +14,8 @@ import ( "github.com/goto/shield/core/resource" "github.com/goto/shield/core/user" "github.com/goto/shield/internal/schema" - "github.com/goto/shield/pkg/errors" "github.com/goto/shield/pkg/db" - + "github.com/goto/shield/pkg/errors" ) const ( diff --git a/core/servicedata/service_test.go b/core/servicedata/service_test.go index 36f21bbc7..670949f2d 100644 --- a/core/servicedata/service_test.go +++ b/core/servicedata/service_test.go @@ -16,7 +16,7 @@ import ( "github.com/goto/shield/internal/schema" errorsPkg "github.com/goto/shield/pkg/errors" "github.com/goto/shield/pkg/logger" - + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/internal/api/v1beta1/group.go b/internal/api/v1beta1/group.go index 8868a9f13..1cc4add8b 100644 --- a/internal/api/v1beta1/group.go +++ b/internal/api/v1beta1/group.go @@ -38,8 +38,10 @@ type GroupService interface { ListGroupRelations(ctx context.Context, objectId, subjectType, role string) ([]user.User, []group.Group, map[string][]string, map[string][]string, error) } -var grpcGroupNotFoundErr = status.Errorf(codes.NotFound, "group doesn't exist") -var grpcInvalidOrgIDErr = status.Errorf(codes.InvalidArgument, "ordIs is not valid uuid") +var ( + grpcGroupNotFoundErr = status.Errorf(codes.NotFound, "group doesn't exist") + grpcInvalidOrgIDErr = status.Errorf(codes.InvalidArgument, "ordIs is not valid uuid") +) func (h Handler) ListGroups(ctx context.Context, request *shieldv1beta1.ListGroupsRequest) (*shieldv1beta1.ListGroupsResponse, error) { logger := grpczap.Extract(ctx) @@ -111,7 +113,7 @@ func (h Handler) CreateGroup(ctx context.Context, request *shieldv1beta1.CreateG return nil, grpcInternalServerError } - //TODO: change this + // TODO: change this metaDataMap, err := metadata.Build(request.GetBody().GetMetadata().AsMap()) if err != nil { logger.Error(err.Error()) @@ -240,7 +242,7 @@ func (h Handler) UpdateGroup(ctx context.Context, request *shieldv1beta1.UpdateG return nil, grpcBadBodyError } - //TODO: change this implementation + // TODO: change this implementation metaDataMap, err := metadata.Build(request.GetBody().GetMetadata().AsMap()) if err != nil { return nil, grpcBadBodyError @@ -313,7 +315,7 @@ func (h Handler) UpdateGroup(ctx context.Context, request *shieldv1beta1.UpdateG serviceDataMap[serviceDataResp.Key.Name] = serviceDataResp.Value } - //Note: this would return only the keys that are updated in the current request + // Note: this would return only the keys that are updated in the current request updatedGroup.Metadata = metaDataMap groupPB, err := transformGroupToPB(updatedGroup) diff --git a/internal/api/v1beta1/mocks/relation_service.go b/internal/api/v1beta1/mocks/relation_service.go index d8d6e7908..c5a87ca79 100644 --- a/internal/api/v1beta1/mocks/relation_service.go +++ b/internal/api/v1beta1/mocks/relation_service.go @@ -1,6 +1,5 @@ // Code generated by mockery v2.42.1. DO NOT EDIT. - package mocks import ( diff --git a/internal/api/v1beta1/user.go b/internal/api/v1beta1/user.go index a811f3b66..b4f2bad14 100644 --- a/internal/api/v1beta1/user.go +++ b/internal/api/v1beta1/user.go @@ -174,7 +174,7 @@ func (h Handler) CreateUser(ctx context.Context, request *shieldv1beta1.CreateUs serviceDataMap[serviceDataResp.Key.Name] = serviceDataResp.Value } - //TODO: use serviceDataMap + // TODO: use serviceDataMap newUser.Metadata = metaDataMap userPB, err := transformUserToPB(newUser) @@ -418,7 +418,7 @@ func (h Handler) UpdateUser(ctx context.Context, request *shieldv1beta1.UpdateUs serviceDataMap[serviceDataResp.Key.Name] = serviceDataResp.Value } - //Note: this would return only the keys that are updated in the current request + // Note: this would return only the keys that are updated in the current request updatedUser.Metadata = metaDataMap userPB, err := transformUserToPB(updatedUser)