Skip to content

refactor: migrate to echo v5 and unpin sentry-go#304

Merged
mxschmitt merged 1 commit into
mainfrom
chore/migrate-echo-v5
May 29, 2026
Merged

refactor: migrate to echo v5 and unpin sentry-go#304
mxschmitt merged 1 commit into
mainfrom
chore/migrate-echo-v5

Conversation

@mxschmitt

Copy link
Copy Markdown
Owner

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, and sentryecho.New() returned a v5 MiddlewareFunc that didn't satisfy the app's echo v4 Use(). This PR does the actual v5 migration so the pin can be lifted.

echo v5 API changes handled

  • Handlers now take *echo.Context (pointer) instead of echo.Context.
  • HTTPErrorHandler signature is now func(*echo.Context, error) (context first); the default is a factory — echo.DefaultHTTPErrorHandler(false).
  • e.Logger is now *slog.LoggerError(msg, "key", val) instead of Error(err).
  • echo.Map removed → map[string]any.
  • c.Response() returns http.ResponseWriter directly → dropped .Writer.
  • Echo.Start/Echo.Shutdown removed → wrap *echo.Echo (it implements http.Handler) in a standard http.Server, preserving the existing signal-driven graceful-shutdown lifecycle exactly.

Module changes

  • getsentry/sentry-go 0.44.1 → 0.46.2 (unpinned)
  • getsentry/sentry-go/echo 0.44.1 → 0.46.2
  • labstack/echo/v4 4.15.2 → labstack/echo/v5 5.1.1

Verification

  • go build ./..., go vet ./..., go test ./...
  • ./... compiles inside the CI base image golang:1.26-alpine (go1.26.3)
  • Route syntax (:id) and c.Param, c.Bind, c.JSON, c.RealIP, c.Set are unchanged in v5.

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).
@mxschmitt mxschmitt merged commit eb4abcd into main May 29, 2026
12 checks passed
@mxschmitt mxschmitt deleted the chore/migrate-echo-v5 branch May 29, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant