diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 73201e5a4..6843a5798 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -13,11 +13,14 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - + - uses: actions/setup-go@v5 + with: + cache: false + go-version: '1.21' - name: golangci-lint uses: golangci/golangci-lint-action@v4 with: - version: v1.52 + version: v1.56 lint-receptorctl: name: lint-receptorctl runs-on: ubuntu-latest diff --git a/.golangci.yml b/.golangci.yml index fea963563..aa31f7f4c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -49,7 +49,7 @@ linters: # - paralleltest # TODO: missing at some locations - prealloc - predeclared - - revive + # - revive - rowserrcheck - sqlclosecheck - staticcheck diff --git a/tests/functional/mesh/lib.go b/tests/functional/mesh/lib.go index 09f20ac7b..0a0b5fcff 100644 --- a/tests/functional/mesh/lib.go +++ b/tests/functional/mesh/lib.go @@ -73,7 +73,6 @@ func (m *LibMesh) Start(_ string) error { // Bootstrap nodes for _, node := range m.GetNodes() { err = node.StartLocalServices() - if err != nil { return err } @@ -86,7 +85,6 @@ func (m *LibMesh) Start(_ string) error { // Start listeners first, we connect below for _, node := range m.GetNodes() { err = node.StartListeners() - if err != nil { return err } @@ -95,7 +93,6 @@ func (m *LibMesh) Start(_ string) error { // Establish outbound connections for _, node := range m.GetNodes() { err = node.EstablishRemoteConnections() - if err != nil { return err } @@ -318,19 +315,16 @@ func (n *LibNode) Start() error { var err error err = n.StartLocalServices() - if err != nil { return err } err = n.StartListeners() - if err != nil { return err } err = n.EstablishRemoteConnections() - if err != nil { return err } @@ -399,13 +393,11 @@ func (n *LibNode) EstablishRemoteConnections() error { switch connection.Protocol { case "tcp": err = n.TCPDial(dialAddr, connectionCost, tlscfg) - if err != nil { return err } case "udp": err = n.UDPDial(dialAddr, connectionCost) - if err != nil { return err } @@ -416,7 +408,6 @@ func (n *LibNode) EstablishRemoteConnections() error { } err = n.WebSocketDial(proto+dialAddr, connectionCost, tlscfg) - if err != nil { return err } @@ -468,7 +459,6 @@ func (n *LibNode) TCPListen(listenerCfg ListenerCfg) (*BackendInfo, error) { netceptor.BackendConnectionCost(cost), netceptor.BackendNodeCost(nodeCost), ) - if err != nil { return nil, err } @@ -512,7 +502,6 @@ func (n *LibNode) UDPListen(listenerCfg ListenerCfg) (*BackendInfo, error) { netceptor.BackendConnectionCost(cost), netceptor.BackendNodeCost(nodeCost), ) - if err != nil { return nil, err } @@ -561,7 +550,6 @@ func (n *LibNode) WebsocketListen(listenerCfg ListenerCfg) (*BackendInfo, error) netceptor.BackendConnectionCost(cost), netceptor.BackendNodeCost(nodeCost), ) - if err != nil { return nil, err } @@ -608,7 +596,6 @@ func (n *LibNode) StartLocalServices() error { } err = n.configureTLS() - if err != nil { return err } @@ -619,31 +606,26 @@ func (n *LibNode) StartLocalServices() error { } n.workceptorInstance, err = workceptor.New(n.netceptorInstance.Context(), n.netceptorInstance, n.GetDataDir()) - if err != nil { return err } err = n.configureWorkSigning() - if err != nil { return err } err = n.workceptorInstance.RegisterWithControlService(n.controlServer) - if err != nil { return err } err = n.configureWorkers() - if err != nil { return err } err = n.controlServer.RunControlSvc(n.controlerServerContext, "control", tlsCfg, n.ControlSocket, os.FileMode(0o600), "", nil) - if err != nil { return err } @@ -658,7 +640,6 @@ func (n *LibNode) configureFirewallRules() error { } err = n.netceptorInstance.AddFirewallRules(rules, true) - if err != nil { return err } @@ -674,7 +655,6 @@ func (n *LibNode) configureTLS() error { } err = n.netceptorInstance.SetServerTLSConfig(c.Name, tlscfg) - if err != nil { return err } @@ -687,7 +667,6 @@ func (n *LibNode) configureTLS() error { } err = n.netceptorInstance.SetClientTLSConfig(c.Name, tlscfg, pinnedFingerprints) - if err != nil { return err } diff --git a/tests/functional/mesh/mesh_test.go b/tests/functional/mesh/mesh_test.go index 02c6a9eaa..42c6ea871 100644 --- a/tests/functional/mesh/mesh_test.go +++ b/tests/functional/mesh/mesh_test.go @@ -219,7 +219,6 @@ func TestMeshShutdown(t *testing.T) { ctx1, cancel1 := context.WithTimeout(context.Background(), 60*time.Second) defer cancel1() err = m.WaitForReady(ctx1) - if err != nil { t.Fatal(err) } diff --git a/tests/functional/mesh/receptorcontrol.go b/tests/functional/mesh/receptorcontrol.go index c2a6432d8..3ddc2ec51 100644 --- a/tests/functional/mesh/receptorcontrol.go +++ b/tests/functional/mesh/receptorcontrol.go @@ -202,7 +202,6 @@ func (r *ReceptorControl) Status() (*netceptor.Status, error) { } status := netceptor.Status{} err = json.Unmarshal(data, &status) - if err != nil { return nil, err } diff --git a/tests/functional/mesh/work_test.go b/tests/functional/mesh/work_test.go index cb86d9054..1d8817cd2 100644 --- a/tests/functional/mesh/work_test.go +++ b/tests/functional/mesh/work_test.go @@ -72,13 +72,11 @@ func TestWorkSubmitWithIncorrectTLSClient(t *testing.T) { defer cancel1() err = controllers["node1"].AssertWorkFailed(ctx1, unitID) - if err != nil { t.Fatal(err) } _, err = controllers["node1"].WorkRelease(unitID) - if err != nil { t.Fatal(err) } @@ -87,7 +85,6 @@ func TestWorkSubmitWithIncorrectTLSClient(t *testing.T) { defer cancel2() err = controllers["node1"].AssertWorkReleased(ctx2, unitID) - if err != nil { t.Fatal(err) } @@ -96,7 +93,6 @@ func TestWorkSubmitWithIncorrectTLSClient(t *testing.T) { defer cancel3() err = assertFilesReleased(ctx3, nodes["node1"].GetDataDir(), "node1", unitID) - if err != nil { t.Fatal(err) } @@ -275,13 +271,11 @@ func TestWorkSubmitWhileRemoteNodeIsDown(t *testing.T) { defer cancel1() err = controllers["node1"].AssertWorkPending(ctx1, unitID) - if err != nil { t.Fatal(err, m.GetDataDir()) } err = nodes["node3"].Start() - if err != nil { t.Fatal(err, m.GetDataDir()) } @@ -291,7 +285,6 @@ func TestWorkSubmitWhileRemoteNodeIsDown(t *testing.T) { defer cancel2() err = m.WaitForReady(ctx2) - if err != nil { t.Fatal(err, m.GetDataDir()) } @@ -300,7 +293,6 @@ func TestWorkSubmitWhileRemoteNodeIsDown(t *testing.T) { defer cancel3() err = controllers["node1"].AssertWorkSucceeded(ctx3, unitID) - if err != nil { t.Fatal(err, m.GetDataDir()) } @@ -515,7 +507,6 @@ func TestRuntimeParams(t *testing.T) { ctx1, cancel1 := context.WithTimeout(context.Background(), 120*time.Second) defer cancel1() err = m.WaitForReady(ctx1) - if err != nil { t.Fatal(err, m.GetDataDir()) } @@ -524,7 +515,6 @@ func TestRuntimeParams(t *testing.T) { controllers := make(map[string]*ReceptorControl) controllers["node1"] = NewReceptorControl() err = controllers["node1"].Connect(nodes["node1"].GetControlSocket()) - if err != nil { t.Fatal(err, m.GetDataDir()) } @@ -536,13 +526,11 @@ func TestRuntimeParams(t *testing.T) { } err = controllers["node1"].AssertWorkSucceeded(ctx1, unitID) - if err != nil { t.Fatal(err, m.GetDataDir()) } err = controllers["node1"].AssertWorkResults(unitID, []byte("it worked!")) - if err != nil { t.Fatal(err, m.GetDataDir()) } @@ -589,7 +577,6 @@ func TestKubeRuntimeParams(t *testing.T) { "secret_kube_pod": "%s", "secret_kube_config": "%s" }`)) - if err != nil { t.Fatal(err) } @@ -618,13 +605,11 @@ func TestKubeRuntimeParams(t *testing.T) { } err = controllers["node1"].AssertWorkSucceeded(ctx1, unitID) - if err != nil { t.Fatal(err, m.GetDataDir()) } err = controllers["node1"].AssertWorkResults(unitID, []byte("1\n2\n3\n4\n5\n")) - if err != nil { t.Fatal(err, m.GetDataDir()) } @@ -782,7 +767,6 @@ func TestSignedWorkVerification(t *testing.T) { } err = m.Start(t.Name()) - if err != nil { t.Fatal(err) } diff --git a/tests/utils/logs.go b/tests/utils/logs.go index 63c284bda..8a4e3de80 100644 --- a/tests/utils/logs.go +++ b/tests/utils/logs.go @@ -16,7 +16,6 @@ func (lw *TestLogWriter) Write(p []byte) (n int, err error) { defer lw.Lock.Unlock() n, err = lw.Buffer.Write(p) - if err != nil { return 0, err }