diff --git a/.gitlab/ci/.code-quality-ci.yml b/.gitlab/ci/.code-quality-ci.yml index 325bd0e1dc77d6f8f89daa89bb65b3b46b93dcac..af2755eb1604ee953f485e985be6349b4fe39f27 100644 --- a/.gitlab/ci/.code-quality-ci.yml +++ b/.gitlab/ci/.code-quality-ci.yml @@ -1,5 +1,5 @@ code-quality: - image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/golangci/golangci-lint:v1.61.0-alpine + image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/golangci/golangci-lint:v1.62.0-alpine stage: analyze script: # writes golangci-lint output to gl-code-quality-report.json diff --git a/Makefile b/Makefile index 083a9087d194d5b58dd5368f7ad58d0237620dec..888644abed5135d8bf2364302499eefd2f2ea0e4 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ PLUGIN_NAME= bundled_plugin.zip # Tool Versions GOTESTSUM_VERSION=v1.8.1 -GOLANGCI_LINT_VERSION=v1.60.2 +GOLANGCI_LINT_VERSION=v1.62.0 MOCKERY_VERSION=v2.20.0 YGOT_GENERATOR_VERSION=v0.27.0 YGOT_GENERATOR_GENERATOR_VERSION=v0.0.4 diff --git a/application-framework/models/model-handling.go b/application-framework/models/model-handling.go index 016406cedcb8c465fd31ff12cc80b3aade1ff9d6..c2d08ab564bdc2eef159c822dd6e968d4f04e59b 100644 --- a/application-framework/models/model-handling.go +++ b/application-framework/models/model-handling.go @@ -45,7 +45,7 @@ func Unmarshal(bytes []byte, path *gpb.Path, goStruct ygot.GoStruct, opt ...ytyp func unmarshal(schema *ytypes.Schema, bytes []byte, path *gpb.Path, goStruct ygot.GoStruct, opt ...ytypes.UnmarshalOpt) error { defer func() { if r := recover(); r != nil { - log.Error(r.(error)) + log.Error(r.(error)) //nolint:errcheck } }() diff --git a/applications/venv-manager/yang-parser/yang-parser.go b/applications/venv-manager/yang-parser/yang-parser.go index b6da0b8425a7f3348075db4dfc4ed0f42fb4f385..dc98e72f0b8a8bac21d67de6e70381508ca83362 100644 --- a/applications/venv-manager/yang-parser/yang-parser.go +++ b/applications/venv-manager/yang-parser/yang-parser.go @@ -25,7 +25,7 @@ func Unmarshal(bytes []byte, path *gpb.Path, goStruct ygot.GoStruct, opt ...ytyp func unmarshal(schema *ytypes.Schema, bytes []byte, path *gpb.Path, goStruct ygot.GoStruct, opt ...ytypes.UnmarshalOpt) error { defer func() { if r := recover(); r != nil { - fmt.Println(r.(error)) + fmt.Println(r.(error)) //nolint:errcheck } }() diff --git a/controller/northbound/server/pnd_test.go b/controller/northbound/server/pnd_test.go index 36944290b94627fea1df1647ed3baa8d4c1ffff8..bc42ffce015cfdcf12a598f3b38f5eb735d08625 100644 --- a/controller/northbound/server/pnd_test.go +++ b/controller/northbound/server/pnd_test.go @@ -58,8 +58,8 @@ func getTestPndServer(t *testing.T) *PndServer { UUID: mneUUID, } - mockNetworkElement.(*nucleus.CommonNetworkElement).SetTransport(&mocks.Transport{}) - mockNetworkElement.(*nucleus.CommonNetworkElement).SetName(hostname) + mockNetworkElement.(*nucleus.CommonNetworkElement).SetTransport(&mocks.Transport{}) //nolint:errcheck + mockNetworkElement.(*nucleus.CommonNetworkElement).SetName(hostname) //nolint:errcheck mockChange := &mocks.Change{} mockChange.On("Age").Return(time.Hour) diff --git a/controller/nucleus/gnmi_transport_test.go b/controller/nucleus/gnmi_transport_test.go index e7230b1af6932ce4d135e5ce2ac34f98fad69374..d8aaf9e590325cbb368280ee3b614083181e6dc4 100644 --- a/controller/nucleus/gnmi_transport_test.go +++ b/controller/nucleus/gnmi_transport_test.go @@ -47,12 +47,12 @@ func TestGnmi_Capabilities(t *testing.T) { capabilityRequest := &gpb.CapabilityRequest{} - transport.client.(*mocks.GNMIClient). - On("NewContext", mockContext, mock.Anything). - Return(mockContext) - transport.client.(*mocks.GNMIClient). - On("Capabilities", mockContext, capabilityRequest). - Return(capabilityResponse, nil) + transport.client.(*mocks.GNMIClient). //nolint:errcheck + On("NewContext", mockContext, mock.Anything). + Return(mockContext) + transport.client.(*mocks.GNMIClient). //nolint:errcheck + On("Capabilities", mockContext, capabilityRequest). + Return(capabilityResponse, nil) type fields struct { transport *Gnmi @@ -142,15 +142,15 @@ func TestGnmi_Get(t *testing.T) { Extension: nil, } - transport.client.(*mocks.GNMIClient). - On("NewContext", mockContext, mock.Anything). - Return(mockContext) - transport.client.(*mocks.GNMIClient). - On("NewGetRequest", mockContext, mock.Anything, mock.Anything). - Return(getRequest, nil) - transport.client.(*mocks.GNMIClient). - On("Get", mockContext, mock.Anything). - Return(getResponse, nil) + transport.client.(*mocks.GNMIClient). //nolint:errcheck + On("NewContext", mockContext, mock.Anything). + Return(mockContext) + transport.client.(*mocks.GNMIClient). //nolint:errcheck + On("NewGetRequest", mockContext, mock.Anything, mock.Anything). + Return(getRequest, nil) + transport.client.(*mocks.GNMIClient). //nolint:errcheck + On("Get", mockContext, mock.Anything). + Return(getResponse, nil) type fields struct { transport *Gnmi @@ -357,8 +357,8 @@ func TestGnmi_Set(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - tt.fields.transport.client.(*mocks.GNMIClient). - On("Set", mockContext, tt.fields.mockArgumentMatcher).Return(setResponse, nil) + tt.fields.transport.client.(*mocks.GNMIClient). //nolint:errcheck + On("Set", mockContext, tt.fields.mockArgumentMatcher).Return(setResponse, nil) err := tt.fields.transport.Set(tt.args.ctx, tt.args.payload) if (err != nil) != tt.wantErr { t.Errorf("Set() error = %v, wantErr %v", err, tt.wantErr) diff --git a/controller/nucleus/pluginFilesystemStore_test.go b/controller/nucleus/pluginFilesystemStore_test.go index 06b6a0a0cdcf828dcc8147bf818188dbedbc624c..1745dee2a82929a9fd84e6b541cf0be46ac2e880 100644 --- a/controller/nucleus/pluginFilesystemStore_test.go +++ b/controller/nucleus/pluginFilesystemStore_test.go @@ -124,9 +124,9 @@ func TestDeleteAllPlugins(t *testing.T) { t.Error(err) } mockPlugin1 := mockPlugin(t) - mockPlugin1.(*mocks.Plugin).On("ID").Return(mockPlugin1ID) + mockPlugin1.(*mocks.Plugin).On("ID").Return(mockPlugin1ID) //nolint:errcheck mockPlugin2 := mockPlugin(t) - mockPlugin2.(*mocks.Plugin).On("ID").Return(mockPlugin2ID) + mockPlugin2.(*mocks.Plugin).On("ID").Return(mockPlugin2ID) //nolint:errcheck inputPlugins := [2]plugin.Plugin{mockPlugin1, mockPlugin2} diff --git a/csbi/write.go b/csbi/write.go index b9ed31815636c79c42b3a63c409531e1895ed330..b005afb523914394403d3eecca94854cc47aaed2 100644 --- a/csbi/write.go +++ b/csbi/write.go @@ -27,7 +27,7 @@ import ( // The output includes a package header which is generated. func write(ctx context.Context, code *gogen.GeneratedCode, path string, sbiType spb.Type) error { if err := os.Mkdir(path, 0755); err != nil { - if err.(*fs.PathError).Err.Error() != "file exists" { //nolint:errorlint + if err.(*fs.PathError).Err.Error() != "file exists" { //nolint:errorlint,errcheck return err } } diff --git a/integration-tests/networkElement_tests/modelUtility_test.go b/integration-tests/networkElement_tests/modelUtility_test.go index 1e87c02adc5844371beadf1f2db8d106800f3a21..fd8b2b22645dd995a92984fa0fc71650c589037c 100644 --- a/integration-tests/networkElement_tests/modelUtility_test.go +++ b/integration-tests/networkElement_tests/modelUtility_test.go @@ -39,7 +39,7 @@ func Unmarshal(bytes []byte, path *gpb.Path, goStruct ygot.GoStruct, opt ...ytyp func unmarshal(schema *ytypes.Schema, bytes []byte, path *gpb.Path, goStruct ygot.GoStruct, opt ...ytypes.UnmarshalOpt) error { defer func() { if r := recover(); r != nil { - logrus.Error(r.(error)) + logrus.Error(r.(error)) //nolint:errcheck } }() diff --git a/plugins/sdk/deviceModel.go b/plugins/sdk/deviceModel.go index 710ee23dd698bf0669473051c52395a3fde557d8..a74960054cdfeb64fb15652817a2eefcc478aa2e 100644 --- a/plugins/sdk/deviceModel.go +++ b/plugins/sdk/deviceModel.go @@ -65,7 +65,7 @@ func unmarshal( opt ...ytypes.UnmarshalOpt) error { defer func() { if r := recover(); r != nil { - log.Error(r.(error)) + log.Error(r.(error)) //nolint:errcheck } }()