Closed joesamcoke closed 2 years ago
Hey @joesamcoke, thanks for giving bud a try!
Can you share what you wrote in your controller/ directory? I just need the signature if the body is private.
Sorry, I was adding a basic controller dependancy on the main controller.
package controller
import (
context "context"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
func Load() (*Controller, error) {
db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})
if err != nil {
return nil, err
}
return &Controller{db}, nil
}
type Controller struct {
db *gorm.DB
}
As per what you have in the docs...
package users
func Load(log log.Logger, env *env.Env) (*Controller, error) {
db, err := pgx.Connect(env.PostgresURL)
if err != nil {
return nil, err
}
return &Controller{log, db}
}
type Controller struct {
log log.Log
db *pgx.Client
}
It maybe just an issue with the code in the docs as it doesn't seem possible to return an error from the Load() function.
Thanks @joesamcoke. Please fix formatting, I can barely read this 😅
eek, ok that's done
Ah interesting, let me try to reproduce this!
Yep, confirmed the issue. We'll get this fixed!
This problem can be simplified to:
package controller
func Load() (*Controller, error) {
return &Controller{}, nil
}
type Controller struct {
}
func (c *Controller) Index() string {
return ""
}
There's a problem somewhere in the controller generator
Jj
@Pubg887 Accident?
Hi, Firstly this project looks great. Really looking forward to working with it.
Getting the error...
bud/.app/controller/controller.go:133:15: too many return values have (nil, error)
Looks the loadController() is missing a return error definination
func loadController() *controller.Controller { controllerController, err := controller.Load() if err != nil { return nil, err } return controllerController }