From 6d31e0fcdaada06fa80fe15759a1f3c95d42c4b9 Mon Sep 17 00:00:00 2001 From: Guillaume Belanger Date: Thu, 4 Jan 2024 15:11:50 -0500 Subject: [PATCH] chore: Adds staticcheck and unused lint check --- .golangci.yml | 4 ++-- factory/factory.go | 3 +-- service/init.go | 9 +++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 2c9cdcf..073d129 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -221,8 +221,8 @@ linters: - gofmt - govet # - errcheck - # - staticcheck - # - unused + - staticcheck + - unused # - gosimple - ineffassign - typecheck diff --git a/factory/factory.go b/factory/factory.go index a8a0f15..500b2ac 100644 --- a/factory/factory.go +++ b/factory/factory.go @@ -12,7 +12,6 @@ package factory import ( "fmt" - "io/ioutil" "os" "gopkg.in/yaml.v2" @@ -43,7 +42,7 @@ func init() { // 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 { UdrConfig = Config{} diff --git a/service/init.go b/service/init.go index aa616d8..cb6453f 100644 --- a/service/init.go +++ b/service/init.go @@ -42,8 +42,7 @@ type UDR struct{} type ( // Config information. Config struct { - udrcfg string - heartBeatTimer string + udrcfg string } ) @@ -366,10 +365,16 @@ func (udr *UDR) UpdateNF() { problemDetails.Status == 404 || problemDetails.Status == 400 { //register with NRF full profile nfProfile, err = udr.BuildAndSendRegisterNFInstance() + if err != nil { + initLog.Errorf("UDR register to NRF Error[%s]", err.Error()) + } } } else if err != nil { initLog.Errorf("UDR update to NRF Error[%s]", err.Error()) nfProfile, err = udr.BuildAndSendRegisterNFInstance() + if err != nil { + initLog.Errorf("UDR register to NRF Error[%s]", err.Error()) + } } if nfProfile.HeartBeatTimer != 0 {