From 54d7508f5dc2b4752eea2bcb001cff30238fa15f Mon Sep 17 00:00:00 2001 From: yusing Date: Sun, 11 May 2025 06:34:35 +0800 Subject: [PATCH] style: gofmt and fix golangcl-ilint --- internal/auth/oidc.go | 2 +- internal/logging/accesslog/config_test.go | 2 +- internal/net/gphttp/gpwebsocket/utils.go | 4 +--- internal/net/gphttp/middleware/bypass_test.go | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/auth/oidc.go b/internal/auth/oidc.go index 3cffa9d..4c8c0b2 100644 --- a/internal/auth/oidc.go +++ b/internal/auth/oidc.go @@ -194,7 +194,7 @@ func parseClaims(idToken *oidc.IDToken) (*IDTokenClaims, error) { return nil, fmt.Errorf("failed to parse claims: %w", err) } if claim.Username == "" { - return nil, fmt.Errorf("missing username in ID token") + return nil, errors.New("missing username in ID token") } return &claim, nil } diff --git a/internal/logging/accesslog/config_test.go b/internal/logging/accesslog/config_test.go index 146364e..a44199d 100644 --- a/internal/logging/accesslog/config_test.go +++ b/internal/logging/accesslog/config_test.go @@ -3,8 +3,8 @@ package accesslog_test import ( "testing" - . "github.com/yusing/go-proxy/internal/logging/accesslog" "github.com/yusing/go-proxy/internal/docker" + . "github.com/yusing/go-proxy/internal/logging/accesslog" "github.com/yusing/go-proxy/internal/utils" expect "github.com/yusing/go-proxy/internal/utils/testing" ) diff --git a/internal/net/gphttp/gpwebsocket/utils.go b/internal/net/gphttp/gpwebsocket/utils.go index 463dcda..e8f9135 100644 --- a/internal/net/gphttp/gpwebsocket/utils.go +++ b/internal/net/gphttp/gpwebsocket/utils.go @@ -16,7 +16,7 @@ func warnNoMatchDomains() { var warnNoMatchDomainOnce sync.Once const ( - HeaderXGoDoxyWebsocketAllowedDomains = "X-GoDoxy-Websocket-Allowed-Domains" + HeaderXGoDoxyWebsocketAllowedDomains = "X-Godoxy-Websocket-Allowed-Domains" ) func WebsocketAllowedDomains(h http.Header) []string { @@ -62,7 +62,6 @@ func Periodic(w http.ResponseWriter, r *http.Request, interval time.Duration, do defer conn.CloseNow() if err := do(conn); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) return } @@ -75,7 +74,6 @@ func Periodic(w http.ResponseWriter, r *http.Request, interval time.Duration, do return case <-ticker.C: if err := do(conn); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) return } } diff --git a/internal/net/gphttp/middleware/bypass_test.go b/internal/net/gphttp/middleware/bypass_test.go index 217d642..c0630ca 100644 --- a/internal/net/gphttp/middleware/bypass_test.go +++ b/internal/net/gphttp/middleware/bypass_test.go @@ -147,7 +147,7 @@ func TestEntrypointBypassRoute(t *testing.T) { } err := entry.SetMiddlewares([]map[string]any{ { - "use": "redirectHTTP", + "use": "redirectHTTP", "bypass": []string{"route test-route"}, }, {