From 0f8b9b48dce9aa8675d73dc5dd55e6bce590dfed Mon Sep 17 00:00:00 2001 From: saileshvvr Date: Sun, 4 Feb 2024 21:43:38 +0530 Subject: [PATCH] Fixed ci-lint error fix lint error fix golangci-lint error for package import fix golangci-lint error for package import fix golangci-lint error for package import fix golangci-lint error for package import fix golangci-lint error for package import --- internal/context/ngap_handler.go | 4 ---- .../consumer/subscriber_data_management.go | 19 +++++++++++-------- internal/sbi/producer/pdu_session.go | 8 ++++---- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/internal/context/ngap_handler.go b/internal/context/ngap_handler.go index 54892bfb..ec797507 100644 --- a/internal/context/ngap_handler.go +++ b/internal/context/ngap_handler.go @@ -44,7 +44,6 @@ func HandlePDUSessionResourceSetupResponseTransfer(b []byte, ctx *SMContext) (er resourceSetupResponseTransfer := ngapType.PDUSessionResourceSetupResponseTransfer{} err = aper.UnmarshalWithParams(b, &resourceSetupResponseTransfer, "valueExt") - if err != nil { return err } @@ -109,7 +108,6 @@ func HandlePDUSessionResourceSetupUnsuccessfulTransfer(b []byte, ctx *SMContext) resourceSetupUnsuccessfulTransfer := ngapType.PDUSessionResourceSetupUnsuccessfulTransfer{} err = aper.UnmarshalWithParams(b, &resourceSetupUnsuccessfulTransfer, "valueExt") - if err != nil { return err } @@ -196,7 +194,6 @@ func HandlePathSwitchRequestSetupFailedTransfer(b []byte, ctx *SMContext) (err e pathSwitchRequestSetupFailedTransfer := ngapType.PathSwitchRequestSetupFailedTransfer{} err = aper.UnmarshalWithParams(b, &pathSwitchRequestSetupFailedTransfer, "valueExt") - if err != nil { return err } @@ -229,7 +226,6 @@ func HandleHandoverRequestAcknowledgeTransfer(b []byte, ctx *SMContext) (err err handoverRequestAcknowledgeTransfer := ngapType.HandoverRequestAcknowledgeTransfer{} err = aper.UnmarshalWithParams(b, &handoverRequestAcknowledgeTransfer, "valueExt") - if err != nil { return err } diff --git a/internal/sbi/consumer/subscriber_data_management.go b/internal/sbi/consumer/subscriber_data_management.go index 11105cec..f2a29184 100644 --- a/internal/sbi/consumer/subscriber_data_management.go +++ b/internal/sbi/consumer/subscriber_data_management.go @@ -4,19 +4,21 @@ import ( "context" "github.com/antihax/optional" + "github.com/pkg/errors" + "github.com/free5gc/openapi" "github.com/free5gc/openapi/Nudm_SubscriberDataManagement" "github.com/free5gc/openapi/models" smf_context "github.com/free5gc/smf/internal/context" "github.com/free5gc/smf/internal/logger" "github.com/free5gc/smf/internal/util" - "github.com/pkg/errors" ) func SDMGetSmData(smCtx *smf_context.SMContext, - smPlmnID *models.PlmnId) (problemDetails *models.ProblemDetails, err error) { + smPlmnID *models.PlmnId, +) (problemDetails *models.ProblemDetails, err error) { // Query UDM - if problemDetails, err := SendNFDiscoveryUDM(); err != nil { + if problemDetails, err = SendNFDiscoveryUDM(); err != nil { smCtx.Log.Warnf("Send NF Discovery Serving UDM Error[%v]", err) } else if problemDetails != nil { smCtx.Log.Warnf("Send NF Discovery Serving UDM Problem[%+v]", problemDetails) @@ -63,12 +65,12 @@ func SDMGetSmData(smCtx *smf_context.SMContext, err = localErr } - return + return problemDetails, err } func SDMSubscribe(smCtx *smf_context.SMContext, smPlmnID *models.PlmnId) ( - problemDetails *models.ProblemDetails, err error) { - + problemDetails *models.ProblemDetails, err error, +) { if !smf_context.GetSelf().Ues.UeExists(smCtx.Supi) { sdmUri := util.SearchNFServiceUri(smf_context.GetSelf().UDMProfile, models.ServiceName_NUDM_SDM, models.NfServiceStatus_REGISTERED) @@ -117,7 +119,8 @@ func SDMSubscribe(smCtx *smf_context.SMContext, smPlmnID *models.PlmnId) ( } func SDMUnSubscribe(smCtx *smf_context.SMContext) (problemDetails *models.ProblemDetails, - err error) { + err error, +) { if smf_context.GetSelf().Ues.IsLastPduSession(smCtx.Supi) { sdmUri := util.SearchNFServiceUri(smf_context.GetSelf().UDMProfile, models.ServiceName_NUDM_SDM, models.NfServiceStatus_REGISTERED) @@ -158,5 +161,5 @@ func SDMUnSubscribe(smCtx *smf_context.SMContext) (problemDetails *models.Proble } else { smf_context.GetSelf().Ues.DecrementPduSessionCount(smCtx.Supi) } - return + return problemDetails, err } diff --git a/internal/sbi/producer/pdu_session.go b/internal/sbi/producer/pdu_session.go index 518016f7..abf301a7 100644 --- a/internal/sbi/producer/pdu_session.go +++ b/internal/sbi/producer/pdu_session.go @@ -95,7 +95,7 @@ func HandlePDUSessionSMContextCreate(isDone <-chan struct{}, } establishmentRequest := m.PDUSessionEstablishmentRequest - if err := HandlePDUSessionEstablishmentRequest(smContext, establishmentRequest); err != nil { + if err = HandlePDUSessionEstablishmentRequest(smContext, establishmentRequest); err != nil { smContext.Log.Errorf("PDU Session Establishment fail by %s", err) gsmError := &GSMError{} if errors.As(err, &gsmError) { @@ -109,7 +109,7 @@ func HandlePDUSessionSMContextCreate(isDone <-chan struct{}, } // Discover and new Namf_Comm client for use later - if problemDetails, err := consumer.SendNFDiscoveryServingAMF(smContext); err != nil { + if problemDetails, err = consumer.SendNFDiscoveryServingAMF(smContext); err != nil { smContext.Log.Warnf("Send NF Discovery Serving AMF Error[%v]", err) } else if problemDetails != nil { smContext.Log.Warnf("Send NF Discovery Serving AMF Problem[%+v]", problemDetails) @@ -125,7 +125,7 @@ func HandlePDUSessionSMContextCreate(isDone <-chan struct{}, } } - if err := smContext.AllocUeIP(); err != nil { + if err = smContext.AllocUeIP(); err != nil { smContext.SetState(smf_context.InActive) smContext.Log.Errorf("PDUSessionSMContextCreate err: %v", err) return makeEstRejectResAndReleaseSMContext(smContext, @@ -133,7 +133,7 @@ func HandlePDUSessionSMContextCreate(isDone <-chan struct{}, &Nsmf_PDUSession.InsufficientResourceSliceDnn) } - if err := smContext.PCFSelection(); err != nil { + if err = smContext.PCFSelection(); err != nil { smContext.Log.Errorln("pcf selection error:", err) }