I have following code:
A struct controller, that have anonymous fields.
type controller struct {
*base.Controller
store *data
}
As you can see, *base.Controller is anonymous fields pointer. Then a second struct that composed with *base.Controller too.
type expiredError struct {
*base.Controller
local string
}
I initialized the controller struct as follow:
c := &controller{base.New(rw, r, false, "controller/account"), nil}
c.Title = "Activate account"
c.serve()
The base.Controller on controller is initialize with base.New() function.
Now I have on controller methods, that initialize the expiredError struct and it should share the pointer of base.Controller to base.Controller of expiredError too.
func (rcv *controller) validate() error {
....
// If time for activating account is expired
if time.Now().Unix() > rcv.store.Expired {
// Delete registered user from neo4j
maccount.Delete(rcv.store.Email, rcv.Local)
return &expiredError{base.Controller, rcv.Local}
}
return nil
}
I've got here a compiler error
type base.Controller is not an expression