refactor: migrate to echo v5 and unpin sentry-go#304
Merged
Conversation
PR #303 pinned getsentry/sentry-go[/echo] to v0.44.1 because v0.45+ moved to echo v5, which broke sentryecho.New() against the app's echo v4. This migrates the app to echo v5 so we can take the latest sentry-go (v0.46.2) without pinning. echo v5 API changes handled: - HandlerFunc/Context: handlers now take *echo.Context (pointer) - HTTPErrorHandler signature is func(*echo.Context, error); the default is now a factory, echo.DefaultHTTPErrorHandler(false) - e.Logger is now *slog.Logger (Error takes a message + key/value args) - echo.Map removed -> use map[string]any - c.Response() returns http.ResponseWriter directly (drop .Writer) - Echo.Start/Shutdown removed -> wrap *echo.Echo (an http.Handler) in a standard http.Server to preserve the existing graceful-shutdown lifecycle Verified: go build/vet/test pass, and ./... compiles inside the CI base image golang:1.26-alpine (go1.26.3).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the app from echo v4 to echo v5, which lets us unpin
getsentry/sentry-go[/echo]and take the latest (v0.46.2).Background
PR #303 pinned
sentry-go[/echo]to v0.44.1 as a deliberate stopgap: v0.45+ migrated to echo v5, andsentryecho.New()returned a v5MiddlewareFuncthat didn't satisfy the app's echo v4Use(). This PR does the actual v5 migration so the pin can be lifted.echo v5 API changes handled
*echo.Context(pointer) instead ofecho.Context.HTTPErrorHandlersignature is nowfunc(*echo.Context, error)(context first); the default is a factory —echo.DefaultHTTPErrorHandler(false).e.Loggeris now*slog.Logger—Error(msg, "key", val)instead ofError(err).echo.Mapremoved →map[string]any.c.Response()returnshttp.ResponseWriterdirectly → dropped.Writer.Echo.Start/Echo.Shutdownremoved → wrap*echo.Echo(it implementshttp.Handler) in a standardhttp.Server, preserving the existing signal-driven graceful-shutdown lifecycle exactly.Module changes
getsentry/sentry-go0.44.1 → 0.46.2 (unpinned)getsentry/sentry-go/echo0.44.1 → 0.46.2labstack/echo/v44.15.2 →labstack/echo/v55.1.1Verification
go build ./...,go vet ./...,go test ./..../...compiles inside the CI base imagegolang:1.26-alpine(go1.26.3):id) andc.Param,c.Bind,c.JSON,c.RealIP,c.Setare unchanged in v5.