E0420: A removed way to declare a dependency
A dependency is written one way: a struct with a constructor whose parameters are its own dependencies, registered in main with app.Service(NewX). Hooks and handlers take it as a parameter, by type, as they take the context, the form and the request. @web.Service on a type and the inject: struct tag are gone; the compiler reports them, and vukavet reports an inject: tag in Go.
The constructor Vuka writes for a decorated struct (a controller, a live page) takes its pointer and interface fields, and nothing else: a mutex, a map or a counter is the struct's own, with no tag to say so. A struct needing anything else writes its own New.
Wrong
vuka
@web.Service
type Notes struct {
db *DB
mu sync.Mutex `inject:"-"`
list []Note `inject:"-"`
}Right
vuka
type Notes struct {
db *DB
mu sync.Mutex
list []Note
}
func NewNotes(db *DB) *Notes { return &Notes{db: db} }
func main() {
app := web.New()
app.Service(NewNotes)
app.Run("")
}