Skip to content

Conversation

@Scorfly
Copy link

@Scorfly Scorfly commented Jan 24, 2026

BREAKING CHANGE: echo integration now requires github.com/labstack/echo/v5 and Go 1.25. Echo v4 is no longer supported.

Dependency and module

  • Bump github.com/labstack/echo from v4.10.1 to v5.0.0.
  • Set go directive to 1.25.0 in echo/go.mod.
  • Drop Echo v4-only indirects (gommon, go-colorable, go-isatty, bytebufferpool, fasttemplate, x/crypto, x/net) and update remaining (x/sys, x/text). go.sum updated accordingly.

Echo v5 API adjustments

  • Use *echo.Context instead of echo.Context in handler and public API (GetHubFromContext, SetHubOnContext, GetSpanFromContext) to match v5’s pointer-based Context.
  • Update all handler signatures in code and docs from func(c echo.Context) error to func(c *echo.Context) error.
  • In v5, Context.Response() returns http.ResponseWriter, not *Response, so ctx.Response().Status is no longer available.

HTTP status and Response handling

  • Replace direct ctx.Response().Status with echo.UnwrapResponse(ctx.Response()) to obtain *echo.Response and use resp.Status when UnwrapResponse succeeds and resp.Status != 0.
  • When UnwrapResponse fails (e.g. middleware replaces the response with a writer that does not unwrap to *echo.Response), leave status at its zero value (0) instead of defaulting to 200.
  • For handler-returned errors, use echo.HTTPStatusCoder instead of *echo.HTTPError so that both *HTTPError and unexported *httpError (ErrNotFound, ErrMethodNotAllowed, etc.) are handled and the correct status is used for the transaction.

Tests

  • In TestIntegration, skip route registration when Handler is nil so the “404 / no route” case does not call router.GET("", nil). Echo v5’s router rejects Handler == nil and panics with “adding route without handler function”.
  • Add TestUnwrapResponseError: when the response is wrapped by a writer that does not implement Unwrap() (e.g. &struct{ http.ResponseWriter }{}), UnwrapResponse returns an error; the middleware must not panic and must record http.response.status_code as 0 in the transaction.

Documentation and examples

  • README.md and example_test.go: switch imports and examples from echo/v4 to echo/v5 and from echo.Context to *echo.Context.

BREAKING CHANGE: echo integration now requires github.com/labstack/echo/v5
and Go 1.25. Echo v4 is no longer supported.

## Dependency and module

- Bump github.com/labstack/echo from v4.10.1 to v5.0.0.
- Set go directive to 1.25.0 in echo/go.mod.
- Drop Echo v4-only indirects (gommon, go-colorable, go-isatty,
  bytebufferpool, fasttemplate, x/crypto, x/net) and update remaining
  (x/sys, x/text). go.sum updated accordingly.

## Echo v5 API adjustments

- Use *echo.Context instead of echo.Context in handler and public API
  (GetHubFromContext, SetHubOnContext, GetSpanFromContext) to match
  v5’s pointer-based Context.
- Update all handler signatures in code and docs from
  `func(c echo.Context) error` to `func(c *echo.Context) error`.
- In v5, Context.Response() returns http.ResponseWriter, not *Response,
  so ctx.Response().Status is no longer available.

## HTTP status and Response handling

- Replace direct ctx.Response().Status with echo.UnwrapResponse(ctx.Response())
  to obtain *echo.Response and use resp.Status when UnwrapResponse succeeds
  and resp.Status != 0.
- When UnwrapResponse fails (e.g. middleware replaces the response with a
  writer that does not unwrap to *echo.Response), leave status at its zero
  value (0) instead of defaulting to 200.
- For handler-returned errors, use echo.HTTPStatusCoder instead of
  *echo.HTTPError so that both *HTTPError and unexported *httpError
  (ErrNotFound, ErrMethodNotAllowed, etc.) are handled and the correct
  status is used for the transaction.

## Tests

- In TestIntegration, skip route registration when Handler is nil so the
  “404 / no route” case does not call router.GET("", nil). Echo v5’s
  router rejects Handler == nil and panics with “adding route without
  handler function”.
- Add TestUnwrapResponseError: when the response is wrapped by a writer
  that does not implement Unwrap() (e.g. &struct{ http.ResponseWriter }{}),
  UnwrapResponse returns an error; the middleware must not panic and must
  record http.response.status_code as 0 in the transaction.

## Documentation and examples

- README.md and example_test.go: switch imports and examples from
  echo/v4 to echo/v5 and from echo.Context to *echo.Context.
@github-actions
Copy link

github-actions bot commented Jan 24, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (echo) Add support for Echo v5 by Scorfly in #1183

Internal Changes 🔧

Release

  • Fix changelog-preview permissions by BYK in #1181
  • Switch from action-prepare-release to Craft by BYK in #1167

Other

  • (repo) Add Claude Code settings with basic permissions by philipphofmann in #1175
  • Update release and changelog-preview workflows by giortzisg in #1177
  • Bump echo to 4.10.1 by giortzisg in #1174

🤖 This preview updates automatically when you update the PR.

@giortzisg
Copy link
Contributor

Hey @Scorfly, we can't really support this right now, since the module versioning needs to be consistent across packages, and we also want to support the three latest go versions.

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.

2 participants