Modernize context.go by replacing interface{} with any #2822
+23
−23
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
Modernizes the Echo Context interface by replacing all instances of
interface{}with the more readableanytype alias introduced in Go 1.18.Changes
23 Modernizations across Context interface methods:
Get(key string) interface{}→Get(key string) anySet(key string, val interface{})→Set(key string, val any)Bind(i interface{})→Bind(i any)Validate(i interface{})→Validate(i any)Render(code int, name string, data interface{})→Render(code int, name string, data any)JSON(code int, i interface{})→JSON(code int, i any)JSONP(code int, callback string, i interface{})→JSONP(code int, callback string, i any)XML(code int, i interface{})→XML(code int, i any)Blob(code int, contentType string, b []byte)→ (internal any usage)Stream(code int, contentType string, r io.Reader)→ (internal any usage)interface{}parametersBenefits
🚀 Modernization
📖 Developer Experience
anyis more intuitive and self-documenting thaninterface{}🔒 Safety & Compatibility
anyis just an alias forinterface{}Testing
Type of Change
Impact
This change modernizes Echo's public API to follow current Go conventions while maintaining perfect backward compatibility. Developers using Echo will benefit from:
This is a pure modernization change with zero risk -
anyandinterface{}are functionally identical.