Skip to content

Commit

Permalink
refactor: pass golangci
Browse files Browse the repository at this point in the history
Signed-off-by: wushiling50 <2531010934@qq.com>
  • Loading branch information
wushiling50 committed Sep 16, 2024
1 parent 6bf7398 commit d6a43db
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions components/delay_queue/azure/servicebus/servicebus.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ func (a *azureServiceBus) PublishDelayMessage(ctx context.Context, request *dela
err := a.Publish(ctx, req)
return nil, err
}

// TODO
func (a *azureServiceBus) Publish(ctx context.Context, req *pubsub.PublishRequest) error {
return nil
}
2 changes: 1 addition & 1 deletion components/hello/helloworld/helloworld_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/stretchr/testify/assert"

"mosn.io/layotto/components/pkg/common"
common "mosn.io/layotto/components/pkg/common"

"mosn.io/layotto/components/hello"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/grpc/default_api/api_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (

func (a *api) TryLock(ctx context.Context, req *runtimev1pb.TryLockRequest) (*runtimev1pb.TryLockResponse, error) {
// 1. validate
if a.lockStores == nil || len(a.lockStores) == 0 {
if len(a.lockStores) == 0 {
err := status.Error(codes.FailedPrecondition, messages.ErrLockStoresNotConfigured)
log.DefaultLogger.Errorf("[runtime] [grpc.TryLock] error: %v", err)
return &runtimev1pb.TryLockResponse{}, err
Expand Down Expand Up @@ -75,7 +75,7 @@ func (a *api) TryLock(ctx context.Context, req *runtimev1pb.TryLockRequest) (*ru

func (a *api) Unlock(ctx context.Context, req *runtimev1pb.UnlockRequest) (*runtimev1pb.UnlockResponse, error) {
// 1. validate
if a.lockStores == nil || len(a.lockStores) == 0 {
if len(a.lockStores) == 0 {
err := status.Error(codes.FailedPrecondition, messages.ErrLockStoresNotConfigured)
log.DefaultLogger.Errorf("[runtime] [grpc.Unlock] error: %v", err)
return newInternalErrorUnlockResponse(), err
Expand Down
4 changes: 2 additions & 2 deletions pkg/grpc/default_api/api_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (

func (a *api) GetSecret(ctx context.Context, in *runtimev1pb.GetSecretRequest) (*runtimev1pb.GetSecretResponse, error) {
// check parameters
if a.secretStores == nil || len(a.secretStores) == 0 {
if len(a.secretStores) == 0 {
err := status.Error(codes.FailedPrecondition, messages.ErrSecretStoreNotConfigured)
log.DefaultLogger.Errorf("GetSecret fail,not configured err:%+v", err)
return &runtimev1pb.GetSecretResponse{}, err
Expand Down Expand Up @@ -72,7 +72,7 @@ func (a *api) GetSecret(ctx context.Context, in *runtimev1pb.GetSecretRequest) (

func (a *api) GetBulkSecret(ctx context.Context, in *runtimev1pb.GetBulkSecretRequest) (*runtimev1pb.GetBulkSecretResponse, error) {
// check parameters
if a.secretStores == nil || len(a.secretStores) == 0 {
if len(a.secretStores) == 0 {
err := status.Error(codes.FailedPrecondition, messages.ErrSecretStoreNotConfigured)
log.DefaultLogger.Errorf("GetBulkSecret fail,not configured err:%+v", err)
return &runtimev1pb.GetBulkSecretResponse{}, err
Expand Down
10 changes: 5 additions & 5 deletions pkg/grpc/default_api/api_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (a *api) DeleteState(ctx context.Context, in *runtimev1pb.DeleteStateReques
// convert and send request
err = store.Delete(ctx, DeleteStateRequest2DeleteRequest(in, key))

// 4. check result
// check result
if err != nil {
err = a.wrapDaprComponentError(err, messages.ErrStateDelete, in.GetKey(), err.Error())
log.DefaultLogger.Errorf("[runtime] [grpc.DeleteState] error: %v", err)
Expand Down Expand Up @@ -209,8 +209,8 @@ func (a *api) ExecuteStateTransaction(ctx context.Context, in *runtimev1pb.Execu
return &emptypb.Empty{}, status.Error(codes.InvalidArgument, "ExecuteStateTransactionRequest is nil")
}

// 1. check params
if a.stateStores == nil || len(a.stateStores) == 0 {
// check params
if len(a.stateStores) == 0 {
err := status.Error(codes.FailedPrecondition, messages.ErrStateStoresNotConfigured)
log.DefaultLogger.Errorf("[runtime] [grpc.ExecuteStateTransaction] error: %v", err)
return &emptypb.Empty{}, err
Expand Down Expand Up @@ -245,7 +245,7 @@ func (a *api) ExecuteStateTransaction(ctx context.Context, in *runtimev1pb.Execu
if err != nil {
return &emptypb.Empty{}, err
}
// 3.2. prepare TransactionalStateOperation struct according to the operation type
// prepare TransactionalStateOperation struct according to the operation type
switch state.OperationType(op.OperationType) {
case state.OperationUpsert:
operation = *StateItem2SetRequest(req, key)
Expand Down Expand Up @@ -319,7 +319,7 @@ func (a *api) getBulkState(ctx context.Context, in *runtimev1pb.GetBulkStateRequ

func (a *api) getStateStore(name string) (state.Store, error) {
// check if the stateStores exists
if a.stateStores == nil || len(a.stateStores) == 0 {
if len(a.stateStores) == 0 {
return nil, status.Error(codes.FailedPrecondition, messages.ErrStateStoresNotConfigured)
}
// check name
Expand Down

0 comments on commit d6a43db

Please sign in to comment.