Skip to content

Commit

Permalink
style: fix naked return (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchennn authored Dec 1, 2023
1 parent 0b08cdd commit d5293ad
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions internal/sbi/consumer/am_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ func AMPolicyControlUpdate(ue *amf_context.AmfUe, updateRequest models.PolicyAss
// TODO: Presence Reporting Area handling (TS 23.503 6.1.2.5, TS 23.501 5.6.11)
// }
}
return
return problemDetails, err
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
err = localErr
return
return problemDetails, err
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
problemDetails = &problem
Expand Down
10 changes: 5 additions & 5 deletions internal/sbi/consumer/communication.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func CreateUEContextRequest(ue *amf_context.AmfUe, ueContextCreateData models.Ue
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
err = localErr
return
return ueContextCreatedData, problemDetails, err
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
problemDetails = &problem
Expand Down Expand Up @@ -182,11 +182,11 @@ func ReleaseUEContextRequest(ue *amf_context.AmfUe, ngapCause models.NgApCause)
}
}()
if localErr == nil {
return
return problemDetails, err
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
err = localErr
return
return problemDetails, err
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
problemDetails = &problem
Expand Down Expand Up @@ -240,7 +240,7 @@ func UEContextTransferRequest(
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
err = localErr
return
return ueContextTransferRspData, problemDetails, err
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
problemDetails = &problem
Expand Down Expand Up @@ -274,7 +274,7 @@ func RegistrationStatusUpdate(ue *amf_context.AmfUe, request models.UeRegStatusU
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
err = localErr
return
return regStatusTransferComplete, problemDetails, err
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
problemDetails = &problem
Expand Down
8 changes: 4 additions & 4 deletions internal/sbi/consumer/nf_mangement.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,25 @@ func BuildNFInstance(context *amf_context.AMFContext) (profile models.NfProfile,
amfInfo := models.AmfInfo{}
if len(context.ServedGuamiList) == 0 {
err = fmt.Errorf("Gumai List is Empty in AMF")
return
return profile, err
}
regionId, setId, _, err1 := util.SeperateAmfId(context.ServedGuamiList[0].AmfId)
if err1 != nil {
err = err1
return
return profile, err
}
amfInfo.AmfRegionId = regionId
amfInfo.AmfSetId = setId
amfInfo.GuamiList = &context.ServedGuamiList
if len(context.SupportTaiLists) == 0 {
err = fmt.Errorf("SupportTaiList is Empty in AMF")
return
return profile, err
}
amfInfo.TaiList = &context.SupportTaiLists
profile.AmfInfo = &amfInfo
if context.RegisterIPv4 == "" {
err = fmt.Errorf("AMF Address is empty")
return
return profile, err
}
profile.Ipv4Addresses = append(profile.Ipv4Addresses, context.RegisterIPv4)
service := []models.NfService{}
Expand Down
4 changes: 2 additions & 2 deletions internal/sbi/consumer/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func SendCreateSmContextRequest(ue *amf_context.AmfUe, smContext *amf_context.Sm
} else if httpResponse != nil {
if httpResponse.Status != err.Error() {
err1 = err
return
return response, smContextRef, errorResponse, problemDetail, err1
}
switch httpResponse.StatusCode {
case 400, 403, 404, 500, 503, 504:
Expand Down Expand Up @@ -451,7 +451,7 @@ func SendUpdateSmContextRequest(smContext *amf_context.SmContext,
} else if httpResponse != nil {
if httpResponse.Status != err.Error() {
err1 = err
return
return response, errorResponse, problemDetail, err1
}
switch httpResponse.StatusCode {
case 400, 403, 404, 500, 503:
Expand Down
10 changes: 5 additions & 5 deletions internal/sbi/consumer/subscriber_data_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func SDMGetAmData(ue *amf_context.AmfUe) (problemDetails *models.ProblemDetails,
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
err = localErr
return
return problemDetails, err
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
problemDetails = &problem
Expand Down Expand Up @@ -94,7 +94,7 @@ func SDMGetSmfSelectData(ue *amf_context.AmfUe) (problemDetails *models.ProblemD
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
err = localErr
return
return problemDetails, err
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
problemDetails = &problem
Expand Down Expand Up @@ -159,11 +159,11 @@ func SDMSubscribe(ue *amf_context.AmfUe) (problemDetails *models.ProblemDetails,
}()
if localErr == nil {
ue.SdmSubscriptionId = resSubscription.SubscriptionId
return
return problemDetails, err
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
err = localErr
return
return problemDetails, err
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
problemDetails = &problem
Expand Down Expand Up @@ -215,7 +215,7 @@ func SDMGetSliceSelectionSubscriptionData(ue *amf_context.AmfUe) (problemDetails
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
err = localErr
return
return problemDetails, err
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
problemDetails = &problem
Expand Down
2 changes: 1 addition & 1 deletion internal/sbi/consumer/ue_authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func SendEapAuthConfirmRequest(ue *amf_context.AmfUe, eapMsg nasType.EAPMessage)
} else if httpResponse != nil {
if httpResponse.Status != err.Error() {
err1 = err
return
return response, problemDetails, err1
}
switch httpResponse.StatusCode {
case 400, 500:
Expand Down

0 comments on commit d5293ad

Please sign in to comment.