From 758bd089857079ee76c860659d6cabf1fdec5315 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Sun, 28 Jul 2024 14:50:37 +0300 Subject: [PATCH] update linter errors --- cmd/main.go | 2 +- commatrix/generate.go | 1 - debug/debug.go | 1 - debug/debug_mock.go | 7 +++---- ss/ss.go | 4 ---- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 0306d3a9..55626f10 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -38,8 +38,8 @@ func main() { cs, err := clientutil.New(kubeconfig) if err != nil { panic("must set the KUBECONFIG environment variable") - } + var env commatrix.Env switch envStr { case "baremetal": diff --git a/commatrix/generate.go b/commatrix/generate.go index 2bf4f8fd..6c4d5716 100644 --- a/commatrix/generate.go +++ b/commatrix/generate.go @@ -19,7 +19,6 @@ import ( ) func GenerateSS(cs *clientutil.ClientSet) (ssMat *types.ComMatrix, ssOutTCP, ssOutUDP []byte, err error) { - nodesList, err := cs.CoreV1Interface.Nodes().List(context.TODO(), metav1.ListOptions{}) if err != nil { return nil, nil, nil, err diff --git a/debug/debug.go b/debug/debug.go index d895d2b3..ab9b4b90 100644 --- a/debug/debug.go +++ b/debug/debug.go @@ -17,7 +17,6 @@ import ( "github.com/openshift-kni/commatrix/client" ) -// DebugPodInterface defines the methods of DebugPod that we need to mock type DebugPodInterface interface { ExecWithRetry(command string, interval time.Duration, duration time.Duration) ([]byte, error) Clean() error diff --git a/debug/debug_mock.go b/debug/debug_mock.go index b3e61e24..019c0bcc 100644 --- a/debug/debug_mock.go +++ b/debug/debug_mock.go @@ -7,24 +7,23 @@ import ( "github.com/stretchr/testify/mock" ) -// MockDebugPod is a mock type for the DebugPodInterface// MockDebugPod is a mock type for the DebugPodInterface type MockDebugPod struct { mock.Mock } -// ExecWithRetry mocks the ExecWithRetry method +// ExecWithRetry mocks the ExecWithRetry method. func (m *MockDebugPod) ExecWithRetry(command string, interval time.Duration, duration time.Duration) ([]byte, error) { args := m.Called(command, interval, duration) return args.Get(0).([]byte), args.Error(1) } -// Clean mocks the Clean method +// Clean mocks the Clean method. func (m *MockDebugPod) Clean() error { args := m.Called() return args.Error(0) } -// GetNodeName mocks the GetNodeName method +// GetNodeName mocks the GetNodeName method. func (m *MockDebugPod) GetNodeName() string { args := m.Called() return args.String(0) diff --git a/ss/ss.go b/ss/ss.go index c7cf7d68..dac90c34 100644 --- a/ss/ss.go +++ b/ss/ss.go @@ -17,10 +17,6 @@ import ( "github.com/openshift-kni/commatrix/types" ) -//type SSGenerator interface { -// CreateSSOutputFromNode(debugPod debug.DebugPodInterface, node *corev1.Node) ([]types.ComDetails, []byte, []byte, error) -//} - const ( localAddrPortFieldIdx = 3 interval = time.Millisecond * 500