Overview
Refactor translator interfaces to use format-specific types instead of generic interface{}, providing better compile-time guarantees and clearer contracts.
Current State
type Translator interface {
Translate(feed interface{}, opts *ParseOptions) (*Feed, error)
}
Proposed Design
type AtomTranslator interface {
Translate(feed *atom.Feed, opts *ParseOptions) (*gofeed.Feed, error)
}
type RSSTranslator interface {
Translate(feed *rss.Feed, opts *ParseOptions) (*gofeed.Feed, error)
}
type JSONTranslator interface {
Translate(feed *json.Feed, opts *ParseOptions) (*gofeed.Feed, error)
}
Tasks
Benefits
- Compile-time type safety - no more interface{} and type assertions
- Clearer API contracts for custom translator implementations
- Better IDE support with proper types
- Eliminates runtime type errors in translators
Migration
Users with custom translators will need to update their implementations to use the specific interfaces rather than the generic one.
Related Issues
Overview
Refactor translator interfaces to use format-specific types instead of generic interface{}, providing better compile-time guarantees and clearer contracts.
Current State
Proposed Design
Tasks
Benefits
Migration
Users with custom translators will need to update their implementations to use the specific interfaces rather than the generic one.
Related Issues