From ff55837aec157927dc3ab436bf05a1869eaabe54 Mon Sep 17 00:00:00 2001 From: Guillaume Belanger Date: Thu, 4 Jan 2024 15:41:18 -0500 Subject: [PATCH] chore: Adds errcheck lint check --- .golangci.yml | 2 +- factory/config.go | 5 ++++- producer/data_repository.go | 10 ++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 073d129..915055a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -220,7 +220,7 @@ linters: enable: - gofmt - govet - # - errcheck + - errcheck - staticcheck - unused # - gosimple diff --git a/factory/config.go b/factory/config.go index f5a95dc..4273d0a 100644 --- a/factory/config.go +++ b/factory/config.go @@ -131,7 +131,10 @@ func (c *Config) updateConfig(commChannel chan *protos.NetworkSliceResponse, dbU } } - c.addSmPolicyInfo(ns, dbUpdateChannel) + err := c.addSmPolicyInfo(ns, dbUpdateChannel) + if err != nil { + logger.GrpcLog.Errorf("Error in adding sm policy info to db %v", err) + } } if minConfig == false { // first slice Created diff --git a/producer/data_repository.go b/producer/data_repository.go index c0c5460..2d53564 100644 --- a/producer/data_repository.go +++ b/producer/data_repository.go @@ -57,8 +57,14 @@ func HandleCreateAccessAndMobilityData(request *http_wrapper.Request) *http_wrap // seems something which we should move to mongolib func toBsonM(data interface{}) (ret bson.M) { - tmp, _ := json.Marshal(data) - json.Unmarshal(tmp, &ret) + tmp, err := json.Marshal(data) + if err != nil { + logger.CfgLog.Infoln("marshal fail ", err) + } + err = json.Unmarshal(tmp, &ret) + if err != nil { + logger.CfgLog.Infoln("unmarshal fail ", err) + } return }