From 8ebc370a286f74ed7f217e8a1a481a252cc8b0e8 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Sat, 7 Feb 2026 02:24:32 +0800 Subject: [PATCH] refactor: replace direct error comparison with errors.Is for ErrUserNotFound --- api/internal_sandbox_guest.go | 8 ++++---- api/internal_service_token.go | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/internal_sandbox_guest.go b/api/internal_sandbox_guest.go index efcdcd1..9038f7e 100644 --- a/api/internal_sandbox_guest.go +++ b/api/internal_sandbox_guest.go @@ -1,6 +1,7 @@ package api import ( + "errors" "net/http" "strings" "time" @@ -22,7 +23,7 @@ func (h *handler) internalSandboxGuest(c *gin.Context) { user, err := h.store.GetUserByEmail(c.Request.Context(), sandboxUserEmail) if err != nil { - if err == store.ErrUserNotFound { + if errors.Is(err, store.ErrUserNotFound) { c.JSON(http.StatusNotFound, gin.H{"error": "sandbox_missing"}) return } @@ -45,9 +46,8 @@ func (h *handler) internalSandboxGuest(c *gin.Context) { } c.JSON(http.StatusOK, gin.H{ - "email": sandboxUserEmail, - "proxyUuid": proxyUUID, + "email": sandboxUserEmail, + "proxyUuid": proxyUUID, "proxyUuidExpiresAt": expiresAt, }) } - diff --git a/api/internal_service_token.go b/api/internal_service_token.go index 6befec9..92fbe7f 100644 --- a/api/internal_service_token.go +++ b/api/internal_service_token.go @@ -23,4 +23,3 @@ func isInternalServiceRequest(c *gin.Context) bool { } return token == expected } -