Skip to content

Commit

Permalink
Enable linters (#118)
Browse files Browse the repository at this point in the history
* Enable `gofumpt` linter

* Enable `gci` linter

* Enable `whitespace` linter

* Enable `gosimple` linter

* Enable `ineffassign` linter

* Enable `goconst` linter
  • Loading branch information
gab-arrobo authored May 31, 2024
1 parent b471a46 commit 521750c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 20 deletions.
17 changes: 8 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019 free5GC.org
#
# SPDX-License-Identifier: Apache-2.0
#
#

# This file contains all available configuration options
# with their default values.
Expand Down Expand Up @@ -218,23 +218,22 @@ linters:
- errcheck
- staticcheck
- unused
# - gosimple
# - ineffassign
- gosimple
- ineffassign
- typecheck
# Additional
# - lll
- godox
#- gomnd
#- goconst
- goconst
# - gocognit
# - maligned
# - nestif
# - gomodguard
# - nakedret
# - gci
- gci
- misspell
# - gofumpt
# - whitespace
- gofumpt
- whitespace
- unconvert
- predeclared
- noctx
Expand All @@ -243,7 +242,7 @@ linters:
- asciicheck
#- stylecheck
# - unparam
#- wsl
# - wsl

#disable-all: false
fast: true
Expand Down
2 changes: 1 addition & 1 deletion eventexposure/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (

"github.com/gin-gonic/gin"

logger_util "github.com/omec-project/util/logger"
"github.com/omec-project/udm/logger"
logger_util "github.com/omec-project/util/logger"
)

// Route is the information for every URI.
Expand Down
2 changes: 1 addition & 1 deletion parameterprovision/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (

"github.com/gin-gonic/gin"

logger_util "github.com/omec-project/util/logger"
"github.com/omec-project/udm/logger"
logger_util "github.com/omec-project/util/logger"
)

// Route is the information for every URI.
Expand Down
8 changes: 5 additions & 3 deletions producer/event_exposure.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
"github.com/omec-project/util/httpwrapper"
)

const anyUE = "anyUE"

func HandleCreateEeSubscription(request *httpwrapper.Request) *httpwrapper.Response {
logger.EeLog.Infoln("Handle Create EE Subscription")

Expand Down Expand Up @@ -96,7 +98,7 @@ func CreateEeSubscriptionProcedure(ueIdentity string,
})
return createdEeSubscription, nil
// represents any UEs
case ueIdentity == "anyUE":
case ueIdentity == anyUE:
id, err := udmSelf.EeSubscriptionIDGenerator.Allocate()
if err != nil {
problemDetails := &models.ProblemDetails{
Expand Down Expand Up @@ -157,7 +159,7 @@ func DeleteEeSubscriptionProcedure(ueIdentity string, subscriptionID string) {
}
return true
})
case ueIdentity == "anyUE":
case ueIdentity == anyUE:
udmSelf.UdmUePool.Range(func(key, value interface{}) bool {
ue := value.(*udm_context.UdmUeContext)
delete(ue.EeSubscriptions, subscriptionID)
Expand Down Expand Up @@ -232,7 +234,7 @@ func UpdateEeSubscriptionProcedure(ueIdentity string, subscriptionID string,
return true
})
return nil
case ueIdentity == "anyUE":
case ueIdentity == anyUE:
udmSelf.UdmUePool.Range(func(key, value interface{}) bool {
ue := value.(*udm_context.UdmUeContext)
if _, ok := ue.EeSubscriptions[subscriptionID]; ok {
Expand Down
6 changes: 3 additions & 3 deletions service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func (udm *UDM) updateConfig(commChannel chan *protos.NetworkSliceResponse) bool
break
}
}
if found == false {
if !found {
self.PlmnList = append(self.PlmnList, temp)
logger.GrpcLog.Infoln("Plmn added in the context", self.PlmnList)
}
Expand All @@ -332,7 +332,7 @@ func (udm *UDM) updateConfig(commChannel chan *protos.NetworkSliceResponse) bool
}
}
}
if minConfig == false {
if !minConfig {
// first slice Created
if len(self.PlmnList) > 0 {
minConfig = true
Expand Down Expand Up @@ -382,7 +382,7 @@ func (udm *UDM) BuildAndSendRegisterNFInstance() (models.NfProfile, error) {
return profile, err
}
initLog.Infof("UDM Profile Registering to NRF: %v", profile)
//Indefinite attempt to register until success
// Indefinite attempt to register until success
profile, _, self.NfId, err = consumer.SendRegisterNFInstance(self.NrfUri, self.NfId, profile)
return profile, err
}
Expand Down
2 changes: 1 addition & 1 deletion subscriberdatamanagement/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (

"github.com/gin-gonic/gin"

logger_util "github.com/omec-project/util/logger"
"github.com/omec-project/udm/logger"
logger_util "github.com/omec-project/util/logger"
)

// Route is the information for every URI.
Expand Down
2 changes: 1 addition & 1 deletion ueauthentication/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

logger_util "github.com/omec-project/util/logger"
"github.com/omec-project/udm/logger"
logger_util "github.com/omec-project/util/logger"
)

var HttpLog *logrus.Entry
Expand Down
2 changes: 1 addition & 1 deletion uecontextmanagement/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (

"github.com/gin-gonic/gin"

logger_util "github.com/omec-project/util/logger"
"github.com/omec-project/udm/logger"
logger_util "github.com/omec-project/util/logger"
)

// Route is the information for every URI.
Expand Down

0 comments on commit 521750c

Please sign in to comment.