From 66b8d9adba1ba3284d82b8c812d4f9ab3e314057 Mon Sep 17 00:00:00 2001 From: Patricia Reinoso Date: Wed, 10 Jan 2024 15:08:33 +0100 Subject: [PATCH 1/4] Enable go vet analyzers in CI Signed-off-by: Patricia Reinoso --- .golangci.yml | 9 +++------ producer/generate_auth_data.go | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 59ca42e..f4904ef 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -169,13 +169,10 @@ linters-settings: - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - # enable or disable analyzers by name - enable: - - atomicalign - enable-all: false + # enable all analyzers + enable-all: true disable: - - shadow - disable-all: false + - fieldalignment depguard: list-type: blacklist include-go-root: false diff --git a/producer/generate_auth_data.go b/producer/generate_auth_data.go index 39db7c9..217fe5d 100644 --- a/producer/generate_auth_data.go +++ b/producer/generate_auth_data.go @@ -388,10 +388,10 @@ func GenerateAuthDataProcedure(authInfoRequest models.AuthenticationInfoRequest, problemDetails = &models.ProblemDetails{ Status: http.StatusForbidden, Cause: authenticationRejected, - Detail: deCodeErr.Error(), + Detail: err.Error(), } - logger.UeauLog.Errorln("err", deCodeErr) + logger.UeauLog.Errorln("err", err) return nil, problemDetails } From 7ce3b9e95fdf8f3c352e138797c14f0d8972f433 Mon Sep 17 00:00:00 2001 From: Patricia Reinoso Date: Thu, 11 Jan 2024 16:09:56 +0100 Subject: [PATCH 2/4] enable fieldalignment go vet analyzer Signed-off-by: Patricia Reinoso --- .golangci.yml | 2 -- context/context.go | 6 +++--- factory/config.go | 2 +- httpcallback/router.go | 17 ++++++----------- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f4904ef..2be6683 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -171,8 +171,6 @@ linters-settings: - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf # enable all analyzers enable-all: true - disable: - - fieldalignment depguard: list-type: blacklist include-go-root: false diff --git a/context/context.go b/context/context.go index cd48f20..231efd7 100644 --- a/context/context.go +++ b/context/context.go @@ -39,7 +39,6 @@ type UDMContext struct { Name string NfId string GroupId string - SBIPort int RegisterIPv4 string // IP register to NRF BindingIPv4 string UriScheme models.UriScheme @@ -53,6 +52,7 @@ type UDMContext struct { Keys *factory.Keys EeSubscriptionIDGenerator *idgenerator.IDGenerator PlmnList []factory.PlmnSupportItem + SBIPort int } type UdmUeContext struct { @@ -65,7 +65,6 @@ type UdmUeContext struct { AccessAndMobilitySubscriptionData *models.AccessAndMobilitySubscriptionData SmfSelSubsData *models.SmfSelectionSubscriptionData UeCtxtInSmfData *models.UeContextInSmfData - TraceDataResponse models.TraceDataResponse TraceData *models.TraceData SessionManagementSubsData map[string]models.SessionManagementSubscriptionData SubsDataSets *models.SubscriptionDataSets @@ -75,6 +74,7 @@ type UdmUeContext struct { UdrUri string UdmSubsToNotify map[string]*models.SubscriptionDataSubscriptions EeSubscriptions map[string]*models.EeSubscription // subscriptionID as key + TraceDataResponse models.TraceDataResponse amSubsDataLock sync.Mutex smfSelSubsDataLock sync.Mutex SmSubsDataLock sync.RWMutex @@ -87,9 +87,9 @@ func (ue *UdmUeContext) init() { } type UdmNFContext struct { - SubscriptionID string SubscribeToNotifChange *models.SdmSubscription // SubscriptionID as key SubscribeToNotifSharedDataChange *models.SdmSubscription // SubscriptionID as key + SubscriptionID string } func (context *UDMContext) GetUdmProfileAHNPublicKey() string { diff --git a/factory/config.go b/factory/config.go index 3cec936..15d5c7f 100644 --- a/factory/config.go +++ b/factory/config.go @@ -47,12 +47,12 @@ type Configuration struct { } type Sbi struct { + Tls *Tls `yaml:"tls,omitempty"` Scheme string `yaml:"scheme"` RegisterIPv4 string `yaml:"registerIPv4,omitempty"` // IP that is registered at NRF. // IPv6Addr string `yaml:"ipv6Addr,omitempty"` BindingIPv4 string `yaml:"bindingIPv4,omitempty"` // IP used to run the server in the node. Port int `yaml:"port,omitempty"` - Tls *Tls `yaml:"tls,omitempty"` } type Tls struct { diff --git a/httpcallback/router.go b/httpcallback/router.go index 55e7301..f674659 100644 --- a/httpcallback/router.go +++ b/httpcallback/router.go @@ -23,14 +23,14 @@ func init() { // Route is the information for every URI. type Route struct { + // HandlerFunc is the handler function of this route. + HandlerFunc gin.HandlerFunc // Name is the name of this Route. Name string // Method is the string for the HTTP method. ex) GET, POST etc.. Method string // Pattern is the pattern of the URI. Pattern string - // HandlerFunc is the handler function of this route. - HandlerFunc gin.HandlerFunc } // Routes is the list of the generated Route. @@ -70,16 +70,11 @@ func Index(c *gin.Context) { var routes = Routes{ { - "Index", - "GET", - "/", - Index, + Name: "Index", Method: "GET", + Pattern: "/", HandlerFunc: Index, }, - { - "DataChangeNotificationToNF", - strings.ToUpper("Post"), - "/sdm-subscriptions", - HTTPDataChangeNotificationToNF, + Name: "DataChangeNotificationToNF", Method: strings.ToUpper("Post"), + Pattern: "/sdm-subscriptions", HandlerFunc: HTTPDataChangeNotificationToNF, }, } From 468226f5edcac66d0b9cfed43e53e425bc3e43df Mon Sep 17 00:00:00 2001 From: Patricia Reinoso Date: Mon, 15 Jan 2024 14:47:30 +0100 Subject: [PATCH 3/4] Update httpcallback/router.go Co-authored-by: gab-arrobo --- httpcallback/router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpcallback/router.go b/httpcallback/router.go index f674659..f73ce1b 100644 --- a/httpcallback/router.go +++ b/httpcallback/router.go @@ -74,7 +74,7 @@ var routes = Routes{ Pattern: "/", HandlerFunc: Index, }, { - Name: "DataChangeNotificationToNF", Method: strings.ToUpper("Post"), + Name: "DataChangeNotificationToNF", Method: "POST", Pattern: "/sdm-subscriptions", HandlerFunc: HTTPDataChangeNotificationToNF, }, } From f1a121250bffb4c7d40c9ac5f284008c97937ae3 Mon Sep 17 00:00:00 2001 From: "Arrobo, Gabriel" Date: Mon, 15 Jan 2024 13:37:12 -0800 Subject: [PATCH 4/4] gofmt file --- httpcallback/router.go | 1 - 1 file changed, 1 deletion(-) diff --git a/httpcallback/router.go b/httpcallback/router.go index f73ce1b..502fc24 100644 --- a/httpcallback/router.go +++ b/httpcallback/router.go @@ -7,7 +7,6 @@ package httpcallback import ( "net/http" - "strings" "github.com/gin-gonic/gin" "github.com/omec-project/logger_util"