Skip to content

feat(echo)!: support Echo v5 as module github.com/rennf93/echo-guard/v2 - #52

Merged
rennf93 merged 2 commits into
masterfrom
feat/echo-v5
Oct 19, 2026
Merged

rennf93 merged 2 commits into
masterfrom
feat/echo-v5

Conversation

@rennf93

@rennf93 rennf93 commented Oct 19, 2026

Copy link
Copy Markdown
Member

Closes #51

master moves to Echo v5 as module github.com/rennf93/echo-guard/v2. Echo v4 users stay on v1.x. Branch v1 is at v1.5.0 plus CI bumps (5070976).

Forced signature changes. Every other exported identifier is unchanged.

  1. New(engine, opts...) returns Echo v5's echo.MiddlewareFunc.
  2. GuardWebSocket(engine, c) takes *echo.Context.
  3. NewStatusHandler(engine) returns Echo v5's echo.HandlerFunc.
  4. AddStatusRoute(app, engine, path) takes Echo v5's *echo.Echo.

Behavior notes:

  • v5 removed c.Error, so a handler error goes through c.Echo().HTTPErrorHandler before the status is read, the same order v1.5.0 used.
  • The adapter reaches the *echo.Response with echo.UnwrapResponse (echo v5.4.0 response.go:121) and swaps the capture and held writers underneath it.
  • A writer chain that never reaches an *echo.Response, or a handler error on a context without an Echo instance, fails closed with the 500 Security check failed response. Two new tests cover these paths.
  • The engine floor is guard-core-go v4.4.1, which stops printing the spec DEBUG lines on every request.

Verified locally:

  • On Go 1.26.0: gofmt -l . prints nothing, and go vet ./... and staticcheck ./... pass.
  • REDIS_HOST=127.0.0.1 go test -tags integration -coverprofile=cover.out . gives ok ... coverage: 100.0% of statements, and check_coverage.sh gives coverage 100%.
  • Both examples build.
  • make lint exits 0.
  • govulncheck ./... on Go 1.27.2: No vulnerabilities found.

Port the adapter, tests, examples, docs and CI to github.com/labstack/echo/v5 v5.4.0. The module path gains the /v2 suffix because the public types change (echo.MiddlewareFunc, echo.HandlerFunc and *echo.Context). Echo v4 users stay on v1.x. The guard-core-go/v4 v4.4.0 floor is unchanged.
@github-actions github-actions Bot added documentation Docs, README, governance files dependencies go.mod or go.sum changes area: middleware Touches the Echo adapter middleware and request shim tests Test suite changes examples Example application changes ci GitHub Actions workflows build Module files / packaging labels Oct 19, 2026
@rennf93
rennf93 merged commit 241f6bd into master Oct 19, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: middleware Touches the Echo adapter middleware and request shim build Module files / packaging ci GitHub Actions workflows dependencies go.mod or go.sum changes documentation Docs, README, governance files examples Example application changes tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

echo-guard cannot be used with Echo v5

1 participant