diff --git a/enterprise/wsproxy/wsproxy.go b/enterprise/wsproxy/wsproxy.go index a8b05123a1be1..cb66c411d3c70 100644 --- a/enterprise/wsproxy/wsproxy.go +++ b/enterprise/wsproxy/wsproxy.go @@ -463,7 +463,7 @@ func (s *Server) pingSiblingReplicas(replicas []codersdk.Replica) { errStr := pingSiblingReplicas(ctx, s.Logger, &s.replicaPingSingleflight, s.derpMeshTLSConfig, replicas) s.replicaErrMut.Lock() s.replicaErr = errStr - s.replicaErrMut.Unlock() + defer s.replicaErrMut.Unlock() if s.Options.ReplicaErrCallback != nil { s.Options.ReplicaErrCallback(replicas, s.replicaErr) } diff --git a/enterprise/wsproxy/wsproxy_test.go b/enterprise/wsproxy/wsproxy_test.go index 430807a60ae67..b3768c3603f16 100644 --- a/enterprise/wsproxy/wsproxy_test.go +++ b/enterprise/wsproxy/wsproxy_test.go @@ -312,7 +312,7 @@ resourceLoop: t.Parallel() // Try to connect to the DERP server on the no-derp-proxy region. - client, err := derphttp.NewClient(key.NewNode(), proxyAPI3.Options.AccessURL.String(), func(format string, args ...any) {}) + client, err := derphttp.NewClient(key.NewNode(), proxyAPI3.Options.AccessURL.String(), func(string, ...any) {}) require.NoError(t, err) ctx := testutil.Context(t, testutil.WaitLong) @@ -405,7 +405,7 @@ func TestDERPEndToEnd(t *testing.T) { proxyOnlyDERPMap.OmitDefaultRegions = true return true }, testutil.WaitLong, testutil.IntervalMedium) - newDERPMapper := func(derpMap *tailcfg.DERPMap) *tailcfg.DERPMap { + newDERPMapper := func(_ *tailcfg.DERPMap) *tailcfg.DERPMap { return proxyOnlyDERPMap } api.AGPL.DERPMapper.Store(&newDERPMapper) @@ -577,7 +577,7 @@ func TestWorkspaceProxyDERPMeshProbe(t *testing.T) { registerBrokenProxy := func(ctx context.Context, t *testing.T, primaryAccessURL *url.URL, accessURL, token string) uuid.UUID { t.Helper() // Create a HTTP server that always replies with 500. - srv := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + srv := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.WriteHeader(http.StatusInternalServerError) })) t.Cleanup(srv.Close) @@ -848,7 +848,7 @@ func TestWorkspaceProxyDERPMeshProbe(t *testing.T) { proxy := coderdenttest.NewWorkspaceProxyReplica(t, api, client, &coderdenttest.ProxyOptions{ Name: "proxy-2", ProxyURL: proxyURL, - ReplicaPingCallback: func(replicas []codersdk.Replica, err string) { + ReplicaPingCallback: func(_ []codersdk.Replica, err string) { replicaPingErr <- err }, })