Skip to content

Commit

Permalink
chore: Enable staticcheck linter and fix reported issues (#176)
Browse files Browse the repository at this point in the history
Co-authored-by: gab-arrobo <[email protected]>
  • Loading branch information
ghislainbourgeois and gab-arrobo authored Jan 17, 2024
1 parent de7d473 commit 0a9ea77
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ linters:
- gofmt
- govet
- errcheck
# - staticcheck
- staticcheck
# - unused
# - gosimple
# - structcheck
Expand Down
2 changes: 1 addition & 1 deletion context/amf_ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ type AmfUe struct {
SmContextList sync.Map `json:"-"` // map[int32]*SmContext, pdu session id as key
/* Related Context*/
//RanUe map[models.AccessType]*RanUe `json:"ranUe,omitempty" yaml:"ranUe" bson:"ranUe,omitempty"`
RanUe map[models.AccessType]*RanUe `json:"ranUe,omitEmpty"`
RanUe map[models.AccessType]*RanUe `json:"ranUe,omitempty"`
/* other */
OnGoing map[models.AccessType]*OnGoingProcedureWithPrio `json:"onGoing,omitempty"`
UeRadioCapability string `json:"ueRadioCapability,omitempty"` // OCTET string
Expand Down
5 changes: 2 additions & 3 deletions factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package factory

import (
"fmt"
"io/ioutil"
"os"
"reflect"

Expand All @@ -24,7 +23,7 @@ var AmfConfig Config

// TODO: Support configuration update from REST api
func InitConfigFactory(f string) error {
if content, err := ioutil.ReadFile(f); err != nil {
if content, err := os.ReadFile(f); err != nil {
return err
} else {
AmfConfig = Config{}
Expand All @@ -38,7 +37,7 @@ func InitConfigFactory(f string) error {
}

func UpdateAmfConfig(f string) error {
if content, err := ioutil.ReadFile(f); err != nil {
if content, err := os.ReadFile(f); err != nil {
return err
} else {
var amfConfig Config
Expand Down
4 changes: 2 additions & 2 deletions nas/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ func HandleNAS(ue *context.RanUe, procedureCode int64, nasPdu []byte) {
rsp.RedirectId = id.PodIp
rsp.GnbId = ue.Ran.GnbId
rsp.Msg = ue.SctplbMsg
if ue != nil && ue.AmfUe != nil {
if ue.AmfUe != nil {
ue.AmfUe.Remove()
} else if ue != nil {
} else {
if err := ue.Remove(); err != nil {
logger.NasLog.Errorf("Error removing ue: %v", err)
}
Expand Down
6 changes: 6 additions & 0 deletions service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,16 @@ func (amf *AMF) UpdateNF() {
problemDetails.Status == 404 || problemDetails.Status == 400 {
// register with NRF full profile
nfProfile, err = amf.BuildAndSendRegisterNFInstance()
if err != nil {
initLog.Errorf("Could not register to NRF Error[%s]", err.Error())
}
}
} else if err != nil {
initLog.Errorf("AMF update to NRF Error[%s]", err.Error())
nfProfile, err = amf.BuildAndSendRegisterNFInstance()
if err != nil {
initLog.Errorf("Could not register to NRF Error[%s]", err.Error())
}
}

if nfProfile.HeartBeatTimer != 0 {
Expand Down

0 comments on commit 0a9ea77

Please sign in to comment.