From d00237770407d51a88347cea89255c42244150a3 Mon Sep 17 00:00:00 2001 From: Thom Carlin Date: Wed, 28 Feb 2024 12:18:37 -0500 Subject: [PATCH] Mark unused-parameter issues --- pkg/certificates/ca_test.go | 2 +- pkg/controlsvc/controlsvc_test.go | 12 ++++++------ pkg/controlsvc/reload.go | 2 +- pkg/netceptor/firewall_rules.go | 2 +- pkg/netceptor/netceptor.go | 2 +- pkg/netceptor/packetconn_test.go | 2 +- pkg/netceptor/tlsconfig_test.go | 6 +++--- pkg/workceptor/workceptor.go | 2 +- pkg/workceptor/workceptor_test.go | 2 +- pkg/workceptor/workunitbase_test.go | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pkg/certificates/ca_test.go b/pkg/certificates/ca_test.go index 92423ce6f..782799b07 100644 --- a/pkg/certificates/ca_test.go +++ b/pkg/certificates/ca_test.go @@ -162,7 +162,7 @@ rydzkVNNVeMVX2TER9yc8AdFqkRlaBWHmO61rYmV+N1quLM0uMVsu55ZNCY= mockRsa := mock_certificates.NewMockRsaer(ctrl) mockRsa.EXPECT().GenerateKey(gomock.Any(), gomock.Any()).DoAndReturn( - func(random io.Reader, bits int) (*rsa.PrivateKey, error) { + func(random io.Reader, bits int) (*rsa.PrivateKey, error) { //nolint:revive return goodCaPrivateKey, nil }, ) diff --git a/pkg/controlsvc/controlsvc_test.go b/pkg/controlsvc/controlsvc_test.go index c6fe49750..b8da13f61 100644 --- a/pkg/controlsvc/controlsvc_test.go +++ b/pkg/controlsvc/controlsvc_test.go @@ -49,7 +49,7 @@ func TestConnectionListener(t *testing.T) { } for _, testCase := range connectionListenerTestCases { - t.Run(testCase.name, func(t *testing.T) { + t.Run(testCase.name, func(t *testing.T) { //nolint:revive ctx, ctxCancel := context.WithCancel(context.Background()) defer ctxCancel() @@ -89,7 +89,7 @@ func TestSetupConnection(t *testing.T) { } for _, testCase := range setupConnectionTestCases { - t.Run(testCase.name, func(t *testing.T) { + t.Run(testCase.name, func(t *testing.T) { //nolint:revive testCase.expectedCalls() s := controlsvc.New(false, mockNetceptor) tlsConn := tls.Client(mockConn, &tls.Config{}) @@ -452,7 +452,7 @@ func TestAddControlFunc(t *testing.T) { { name: "obliterate command", input: "obliterate", - testCase: func(msg string, err error) { + testCase: func(msg string, err error) { //nolint:revive if err != nil { t.Errorf("error should be nil. received %s", err) } @@ -461,7 +461,7 @@ func TestAddControlFunc(t *testing.T) { } for _, testCase := range controlFuncTestsCases { - t.Run(testCase.name, func(t *testing.T) { + t.Run(testCase.name, func(t *testing.T) { //nolint:revive s := controlsvc.New(true, mockNetceptor) err := s.AddControlFunc(testCase.input, mockCtrlCmd) testCase.testCase(testCase.errorMessage, err) @@ -522,7 +522,7 @@ func TestRunControlSession(t *testing.T) { } for _, testCase := range runControlSessionTestCases { - t.Run(testCase.name, func(t *testing.T) { + t.Run(testCase.name, func(t *testing.T) { //nolint:revive mandatoryExpects() testCase.expectedCalls() s := controlsvc.New(false, mockNetceptor) @@ -592,7 +592,7 @@ func TestRunControlSessionTwo(t *testing.T) { } for _, testCase := range runControlSessionTestCases { - t.Run(testCase.name, func(t *testing.T) { + t.Run(testCase.name, func(t *testing.T) { //nolint:revive testCase.expectedCalls() s := controlsvc.New(true, mockNetceptor) pipeA, pipeB := net.Pipe() diff --git a/pkg/controlsvc/reload.go b/pkg/controlsvc/reload.go index 498158e5e..3118ce5ca 100644 --- a/pkg/controlsvc/reload.go +++ b/pkg/controlsvc/reload.go @@ -17,7 +17,7 @@ type ( var configPath = "" -var reloadParseAndRun = func(toRun []string) error { +var reloadParseAndRun = func(toRun []string) error { //nolint:revive return fmt.Errorf("no configuration file was provided, reload function not set") } diff --git a/pkg/netceptor/firewall_rules.go b/pkg/netceptor/firewall_rules.go index 51763b2d3..74a63f2b6 100644 --- a/pkg/netceptor/firewall_rules.go +++ b/pkg/netceptor/firewall_rules.go @@ -131,7 +131,7 @@ func firewallRule(comparers []CompareFunc, action string) (FirewallRuleFunc, err return nil, fmt.Errorf("unknown action: %s", action) } if len(comparers) == 0 { - return func(md *MessageData) FirewallResult { + return func(md *MessageData) FirewallResult { //nolint:revive return result }, nil } diff --git a/pkg/netceptor/netceptor.go b/pkg/netceptor/netceptor.go index ffdacf840..a9dac4dc0 100644 --- a/pkg/netceptor/netceptor.go +++ b/pkg/netceptor/netceptor.go @@ -1014,7 +1014,7 @@ const ( func ReceptorVerifyFunc(tlscfg *tls.Config, pinnedFingerprints [][]byte, expectedHostname string, expectedHostnameType ExpectedHostnameType, verifyType VerifyType, logger *logger.ReceptorLogger, ) func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { - return func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { + return func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { //nolint:revive if len(rawCerts) == 0 { logger.Error("RVF failed: peer certificate missing") diff --git a/pkg/netceptor/packetconn_test.go b/pkg/netceptor/packetconn_test.go index 26e456f40..288f0e62c 100644 --- a/pkg/netceptor/packetconn_test.go +++ b/pkg/netceptor/packetconn_test.go @@ -155,7 +155,7 @@ func TestPacketConn(t *testing.T) { { "ReadFrom Error", "", - func(ctx context.Context) { + func(ctx context.Context) { //nolint:revive newCtx, ctxCancel := context.WithCancel(context.Background()) time.AfterFunc(time.Microsecond*200, ctxCancel) mockNetceptorForPacketConn.EXPECT().Context().Return(newCtx) diff --git a/pkg/netceptor/tlsconfig_test.go b/pkg/netceptor/tlsconfig_test.go index 16c03e6ac..4f5cc312e 100644 --- a/pkg/netceptor/tlsconfig_test.go +++ b/pkg/netceptor/tlsconfig_test.go @@ -144,7 +144,7 @@ FdaOLykGKfMCYVBP+xs97IJO8En/5N9QQwc+N4cfCg9/BWoZKHPbRx/V+57VEj0m -----END CERTIFICATE----- `)) - return tempCertFile, tempCertKey, tempCA, func(t *testing.T) { + return tempCertFile, tempCertKey, tempCA, func(t *testing.T) { //nolint:revive defer os.Remove(tempCertFile.Name()) defer os.Remove(tempCertKey.Name()) defer os.Remove(tempCA.Name()) @@ -162,7 +162,7 @@ func useUtilsSetupSuite(t *testing.T, name string) (string, string, string, func t.Error(err.Error()) } - return ca, certKey, cert, func(t *testing.T) { + return ca, certKey, cert, func(t *testing.T) { //nolint:revive defer os.Remove(ca) defer os.Remove(certKey) defer os.Remove(cert) @@ -179,7 +179,7 @@ func useUtilsSetupSuiteWithGenerateWithCA(t *testing.T, name string) (string, st t.Error(err.Error()) } - return caCert, cert, certKey, func(t *testing.T) { + return caCert, cert, certKey, func(t *testing.T) { //nolint:revive defer os.Remove(caCert) defer os.Remove(caKey) defer os.Remove(certKey) diff --git a/pkg/workceptor/workceptor.go b/pkg/workceptor/workceptor.go index 3a5455de2..32cbc179a 100644 --- a/pkg/workceptor/workceptor.go +++ b/pkg/workceptor/workceptor.go @@ -224,7 +224,7 @@ func (w *Workceptor) VerifySignature(signature string) error { if err != nil { return fmt.Errorf("could not load verifying key file: %s", err.Error()) } - token, err := jwt.ParseWithClaims(signature, &jwt.RegisteredClaims{}, func(token *jwt.Token) (interface{}, error) { + token, err := jwt.ParseWithClaims(signature, &jwt.RegisteredClaims{}, func(token *jwt.Token) (interface{}, error) { //nolint:revive return rsaPublicKey, nil }) if err != nil { diff --git a/pkg/workceptor/workceptor_test.go b/pkg/workceptor/workceptor_test.go index 8e81e91de..9032e92b4 100644 --- a/pkg/workceptor/workceptor_test.go +++ b/pkg/workceptor/workceptor_test.go @@ -44,7 +44,7 @@ func TestAllocateUnit(t *testing.T) { logger := logger.NewReceptorLogger("") mockNetceptor.EXPECT().GetLogger().AnyTimes().Return(logger) - workFunc := func(bwu workceptor.BaseWorkUnitForWorkUnit, w *workceptor.Workceptor, unitID string, workType string) workceptor.WorkUnit { + workFunc := func(bwu workceptor.BaseWorkUnitForWorkUnit, w *workceptor.Workceptor, unitID string, workType string) workceptor.WorkUnit { //nolint:revive return mockWorkUnit } diff --git a/pkg/workceptor/workunitbase_test.go b/pkg/workceptor/workunitbase_test.go index 702ec5723..bd410e03d 100644 --- a/pkg/workceptor/workunitbase_test.go +++ b/pkg/workceptor/workunitbase_test.go @@ -214,7 +214,7 @@ func TestBaseLoad(t *testing.T) { func TestBaseUpdateFullStatus(t *testing.T) { ctrl, bwu, w, _ := setUp(t) bwu.Init(w, "test", "", workceptor.FileSystem{}, &workceptor.RealWatcher{}) - sf := func(sfd *workceptor.StatusFileData) { + sf := func(sfd *workceptor.StatusFileData) { //nolint:revive // Do nothing } bwu.UpdateFullStatus(sf)