fix linter issues

This commit is contained in:
pascal
2026-02-12 01:15:36 +01:00
parent e20b969188
commit 963e3f5457
5 changed files with 14 additions and 8 deletions

View File

@@ -20,7 +20,7 @@ jobs:
uses: codespell-project/actions-codespell@v2 uses: codespell-project/actions-codespell@v2
with: with:
ignore_words_list: erro,clienta,hastable,iif,groupd,testin,groupe,cros,ans ignore_words_list: erro,clienta,hastable,iif,groupd,testin,groupe,cros,ans
skip: go.mod,go.sum skip: go.mod,go.sum,proxy/web
golangci: golangci:
strategy: strategy:
fail-fast: false fail-fast: false

View File

@@ -845,6 +845,7 @@ func (s *ProxyServiceServer) ValidateSession(ctx context.Context, req *proto.Val
"domain": domain, "domain": domain,
"error": err.Error(), "error": err.Error(),
}).Error("ValidateSession: decode public key") }).Error("ValidateSession: decode public key")
//nolint:nilerr
return &proto.ValidateSessionResponse{ return &proto.ValidateSessionResponse{
Valid: false, Valid: false,
DeniedReason: "invalid_service_config", DeniedReason: "invalid_service_config",

View File

@@ -29,19 +29,19 @@ func (m *mockReverseProxyManager) GetGlobalServices(ctx context.Context) ([]*rev
} }
func (m *mockReverseProxyManager) GetAllServices(ctx context.Context, accountID, userID string) ([]*reverseproxy.Service, error) { func (m *mockReverseProxyManager) GetAllServices(ctx context.Context, accountID, userID string) ([]*reverseproxy.Service, error) {
return nil, nil return []*reverseproxy.Service{}, nil
} }
func (m *mockReverseProxyManager) GetService(ctx context.Context, accountID, userID, reverseProxyID string) (*reverseproxy.Service, error) { func (m *mockReverseProxyManager) GetService(ctx context.Context, accountID, userID, reverseProxyID string) (*reverseproxy.Service, error) {
return nil, nil return &reverseproxy.Service{}, nil
} }
func (m *mockReverseProxyManager) CreateService(ctx context.Context, accountID, userID string, rp *reverseproxy.Service) (*reverseproxy.Service, error) { func (m *mockReverseProxyManager) CreateService(ctx context.Context, accountID, userID string, rp *reverseproxy.Service) (*reverseproxy.Service, error) {
return nil, nil return &reverseproxy.Service{}, nil
} }
func (m *mockReverseProxyManager) UpdateService(ctx context.Context, accountID, userID string, rp *reverseproxy.Service) (*reverseproxy.Service, error) { func (m *mockReverseProxyManager) UpdateService(ctx context.Context, accountID, userID string, rp *reverseproxy.Service) (*reverseproxy.Service, error) {
return nil, nil return &reverseproxy.Service{}, nil
} }
func (m *mockReverseProxyManager) DeleteService(ctx context.Context, accountID, userID, reverseProxyID string) error { func (m *mockReverseProxyManager) DeleteService(ctx context.Context, accountID, userID, reverseProxyID string) error {
@@ -65,7 +65,7 @@ func (m *mockReverseProxyManager) ReloadService(ctx context.Context, accountID,
} }
func (m *mockReverseProxyManager) GetServiceByID(ctx context.Context, accountID, reverseProxyID string) (*reverseproxy.Service, error) { func (m *mockReverseProxyManager) GetServiceByID(ctx context.Context, accountID, reverseProxyID string) (*reverseproxy.Service, error) {
return nil, nil return &reverseproxy.Service{}, nil
} }
func (m *mockReverseProxyManager) GetServiceIDByTargetID(_ context.Context, _, _ string) (string, error) { func (m *mockReverseProxyManager) GetServiceIDByTargetID(_ context.Context, _, _ string) (string, error) {

View File

@@ -151,7 +151,7 @@ func (c *LeaseClient) Get(ctx context.Context, name string) (*Lease, error) {
defer func() { _ = resp.Body.Close() }() defer func() { _ = resp.Body.Close() }()
if resp.StatusCode == http.StatusNotFound { if resp.StatusCode == http.StatusNotFound {
return nil, nil return nil, nil //nolint:nilnil
} }
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
return nil, c.readError(resp) return nil, c.readError(resp)

View File

@@ -597,9 +597,9 @@ func TestRewriteLocationFunc(t *testing.T) {
t.Run("re-adds stripped path prefix", func(t *testing.T) { t.Run("re-adds stripped path prefix", func(t *testing.T) {
resp, err := run(newProxy("https"), "/api", newReq("https://public.example.com/api/users"), resp, err := run(newProxy("https"), "/api", newReq("https://public.example.com/api/users"),
"http://backend.internal:8080/users") "http://backend.internal:8080/users")
defer resp.Body.Close()
require.NoError(t, err) require.NoError(t, err)
defer resp.Body.Close()
assert.Equal(t, "https://public.example.com/api/users", resp.Header.Get("Location")) assert.Equal(t, "https://public.example.com/api/users", resp.Header.Get("Location"))
}) })
@@ -608,6 +608,7 @@ func TestRewriteLocationFunc(t *testing.T) {
"http://backend.internal:8080/path") "http://backend.internal:8080/path")
require.NoError(t, err) require.NoError(t, err)
defer resp.Body.Close()
assert.Equal(t, "http://public.example.com/path", resp.Header.Get("Location")) assert.Equal(t, "http://public.example.com/path", resp.Header.Get("Location"))
}) })
@@ -615,6 +616,7 @@ func TestRewriteLocationFunc(t *testing.T) {
resp, err := run(newProxy("https"), "", newReq("https://public.example.com/"), "") resp, err := run(newProxy("https"), "", newReq("https://public.example.com/"), "")
require.NoError(t, err) require.NoError(t, err)
defer resp.Body.Close()
assert.Empty(t, resp.Header.Get("Location")) assert.Empty(t, resp.Header.Get("Location"))
}) })
@@ -623,6 +625,7 @@ func TestRewriteLocationFunc(t *testing.T) {
"http://backend.internal:8080/login") "http://backend.internal:8080/login")
require.NoError(t, err) require.NoError(t, err)
defer resp.Body.Close()
assert.Equal(t, "https://public.example.com/login", resp.Header.Get("Location")) assert.Equal(t, "https://public.example.com/login", resp.Header.Get("Location"))
}) })
@@ -633,6 +636,7 @@ func TestRewriteLocationFunc(t *testing.T) {
"http://backend.internal:8080/login?redirect=%2Fdashboard&lang=en") "http://backend.internal:8080/login?redirect=%2Fdashboard&lang=en")
require.NoError(t, err) require.NoError(t, err)
defer resp.Body.Close()
assert.Equal(t, "https://public.example.com/login?redirect=%2Fdashboard&lang=en", resp.Header.Get("Location")) assert.Equal(t, "https://public.example.com/login?redirect=%2Fdashboard&lang=en", resp.Header.Get("Location"))
}) })
@@ -641,6 +645,7 @@ func TestRewriteLocationFunc(t *testing.T) {
"http://backend.internal:8080/docs#section-2") "http://backend.internal:8080/docs#section-2")
require.NoError(t, err) require.NoError(t, err)
defer resp.Body.Close()
assert.Equal(t, "https://public.example.com/docs#section-2", resp.Header.Get("Location")) assert.Equal(t, "https://public.example.com/docs#section-2", resp.Header.Get("Location"))
}) })