From 3980e4e0c3ddd470dac154263125fb205f1a1d82 Mon Sep 17 00:00:00 2001 From: tim1207 Date: Wed, 27 Nov 2024 06:13:38 +0000 Subject: [PATCH] fix: fix lint err --- internal/sbi/consumer/pcf_service.go | 25 ++++++++++++------------- internal/sbi/consumer/smf_service.go | 28 ++++++++++++++-------------- internal/sbi/consumer/udm_service.go | 4 ++-- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/internal/sbi/consumer/pcf_service.go b/internal/sbi/consumer/pcf_service.go index fad706f..81711ce 100644 --- a/internal/sbi/consumer/pcf_service.go +++ b/internal/sbi/consumer/pcf_service.go @@ -119,7 +119,6 @@ func (s *npcfService) AMPolicyControlCreate( default: return nil, openapi.ReportError("openapi error") } - } return nil, nil } @@ -203,20 +202,20 @@ func (s *npcfService) AMPolicyControlDelete(ue *amf_context.AmfUe) (problemDetai ue.RemoveAmPolicyAssociation() } else { switch apiErr := err.(type) { - case openapi.GenericOpenAPIError: - // API error - switch errorModel := apiErr.Model().(type) { - case Npcf_AMPolicy.DeleteIndividualAMPolicyAssociationError: - return &errorModel.ProblemDetails, err - case error: - return openapi.ProblemDetailsSystemFailure(errorModel.Error()), err - default: - return nil, openapi.ReportError("openapi error") - } + case openapi.GenericOpenAPIError: + // API error + switch errorModel := apiErr.Model().(type) { + case Npcf_AMPolicy.DeleteIndividualAMPolicyAssociationError: + return &errorModel.ProblemDetails, err case error: - return openapi.ProblemDetailsSystemFailure(apiErr.Error()), apiErr + return openapi.ProblemDetailsSystemFailure(errorModel.Error()), err default: - return nil, openapi.ReportError("openapi error") + return nil, openapi.ReportError("openapi error") + } + case error: + return openapi.ProblemDetailsSystemFailure(apiErr.Error()), apiErr + default: + return nil, openapi.ReportError("openapi error") } } return nil, err diff --git a/internal/sbi/consumer/smf_service.go b/internal/sbi/consumer/smf_service.go index d25d8bf..7b7303d 100644 --- a/internal/sbi/consumer/smf_service.go +++ b/internal/sbi/consumer/smf_service.go @@ -180,13 +180,13 @@ func (s *nsmfService) SendCreateSmContextRequest(ue *amf_context.AmfUe, smContex case openapi.GenericOpenAPIError: // API error switch errModel := errType.Model().(type) { - case Nsmf_PDUSession.PostSmContextsError: - problemDetail = &errModel.ProblemDetails - errorResponse = &errModel.PostSmContextsError - case error: - err1 = errModel - default: - err1 = openapi.ReportError("openapi error") + case Nsmf_PDUSession.PostSmContextsError: + problemDetail = &errModel.ProblemDetails + errorResponse = &errModel.PostSmContextsError + case error: + err1 = errModel + default: + err1 = openapi.ReportError("openapi error") } case error: problemDetail = openapi.ProblemDetailsSystemFailure(err1.Error()) @@ -491,13 +491,13 @@ func (s *nsmfService) SendUpdateSmContextRequest(smContext *amf_context.SmContex case openapi.GenericOpenAPIError: // API error switch errModel := errType.Model().(type) { - case Nsmf_PDUSession.UpdateSmContextError: - problemDetail = &errModel.ProblemDetails - errorResponse = &errModel.UpdateSmContextResponse400 - case error: - err1 = errModel - default: - err1 = openapi.ReportError("openapi error") + case Nsmf_PDUSession.UpdateSmContextError: + problemDetail = &errModel.ProblemDetails + errorResponse = &errModel.UpdateSmContextResponse400 + case error: + err1 = errModel + default: + err1 = openapi.ReportError("openapi error") } case error: problemDetail = openapi.ProblemDetailsSystemFailure(err1.Error()) diff --git a/internal/sbi/consumer/udm_service.go b/internal/sbi/consumer/udm_service.go index 55bd485..16f2740 100644 --- a/internal/sbi/consumer/udm_service.go +++ b/internal/sbi/consumer/udm_service.go @@ -118,8 +118,8 @@ func (s *nudmService) SDMGetAmData(ue *amf_context.AmfUe) (problemDetails *model } } else { err = localErr - // API error - switch apiErr := localErr.(type){ + // API error + switch apiErr := localErr.(type) { case openapi.GenericOpenAPIError: switch errorModel := apiErr.Model().(type) { case Nudm_SubscriberDataManagement.GetAmDataError: