Skip to content

Commit

Permalink
chore: Enable unconvert linter and fix reported issues (#182)
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 23, 2024
1 parent a4f84c2 commit 869a763
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,14 @@ linters:
#- gomnd
- goconst
# - gocognit
# - maligned
# - nestif
# - gomodguard
- nakedret
- gci
- misspell
- gofumpt
- whitespace
# - unconvert
- unconvert
- predeclared
- noctx
- dogsled
Expand Down
2 changes: 1 addition & 1 deletion context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (context *AMFContext) TmsiAllocate() int32 {
return -1
}
logger.ContextLog.Infof("Allocate TMSI : %v", val)
return int32(val)
return val
}

func (context *AMFContext) AllocateAmfUeNgapID() (int64, error) {
Expand Down
2 changes: 1 addition & 1 deletion context/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func AllocateUniqueID(generator **idgenerator.IDGenerator, idName string) (int64
// Later this value can be used to trigger
// creation of new instance
minVal := int64((val-1)*8192 + 1)
maxVal := int64(minVal + 8192)
maxVal := minVal + 8192
*generator = idgenerator.NewGenerator(minVal, maxVal)
}

Expand Down
2 changes: 1 addition & 1 deletion gmm/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,7 @@ func HandleUeSliceInfoDelete(ue *context.AmfUe, accessType models.AccessType, ns
var problemDetails *models.ProblemDetails
ue.SmContextList.Range(func(key, value interface{}) bool {
smContext := value.(*context.SmContext)
if smContext.Snssai().Sst == int32(nssai.Sst) && smContext.Snssai().Sd == nssai.Sd {
if smContext.Snssai().Sst == nssai.Sst && smContext.Snssai().Sd == nssai.Sd {
logger.GmmLog.Infof("Deleted Slice [sst: %v, sd: %v]matched with smcontext, sending Release SMContext Request to SMF",
smContext.Snssai().Sst, smContext.Snssai().Sd)
// send smcontext release request
Expand Down
2 changes: 1 addition & 1 deletion nas/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func HandleNAS(ue *context.RanUe, procedureCode int64, nasPdu []byte) {
} else {
if amfSelf.EnableSctpLb {
/* checking the guti-ue belongs to this amf instance */
id, err := amfSelf.Drsm.FindOwnerInt32ID(int32(ue.AmfUe.Tmsi))
id, err := amfSelf.Drsm.FindOwnerInt32ID(ue.AmfUe.Tmsi)
if err != nil {
logger.NasLog.Errorf("Error checking guti-ue: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion ngap/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ func HandleInitialUEMessage(ran *context.AmfRan, message *ngapType.NGAPPDU, sctp
} else {
ranUe.Log.Tracef("find AmfUe [GUTI: %s]", guti)
/* checking the guti-ue belongs to this amf instance */
id, err := amfSelf.Drsm.FindOwnerInt32ID(int32(amfUe.Tmsi))
id, err := amfSelf.Drsm.FindOwnerInt32ID(amfUe.Tmsi)
if err != nil {
ranUe.Log.Errorf("Error checking the guti-ue in this instance: %v", err)
}
Expand Down

0 comments on commit 869a763

Please sign in to comment.