qor / auth

Golang Authentication solution
MIT License
734 stars 98 forks source link

Compilation errors while trying to run sample application in README.md #13

Open arindam2 opened 6 years ago

arindam2 commented 6 years ago
  1. I copied the sample application into a main.go in a directory.
  2. I ran dep init -v.
  3. I ran go run main.go.

This throws the following errors:

vendor/github.com/qor/mailer/mailer.go:39:29: cannot use nil as type string in argument to render.New
vendor/github.com/qor/mailer/mailer.go:40:16: config.Render.SetAssetFS undefined (type *render.Render has no field or method SetAssetFS)
vendor/github.com/qor/mailer/template.go:46:83: mailer.Config.Render.Layout(t.Layout + ".text").Funcs(t.funcMap).Render undefined (type *render.Template has no field or method Render, but does have render.render)
vendor/github.com/qor/mailer/template.go:50:83: mailer.Config.Render.Layout(t.Layout + ".html").Funcs(t.funcMap).Render undefined (type *render.Template has no field or method Render, but does have render.render)
vendor/github.com/qor/mailer/template.go:52:82: mailer.Config.Render.Layout(t.Layout).Funcs(t.funcMap).Render undefined (type *render.Template has no field or method Render, but does have render.render)
vendor/github.com/qor/mailer/template.go:56:58: mailer.Config.Render.Funcs(t.funcMap).Render undefined (type *render.Template has no field or method Render, but does have render.render)
vendor/github.com/qor/mailer/template.go:60:58: mailer.Config.Render.Funcs(t.funcMap).Render undefined (type *render.Template has no field or method Render, but does have render.render)
vendor/github.com/qor/mailer/template.go:62:65: mailer.Config.Render.Funcs(t.funcMap).Render undefined (type *render.Template has no field or method Render, but does have render.render)
# auth/vendor/github.com/qor/session/gorilla
vendor/github.com/qor/session/gorilla/gorilla.go:26:12: undefined: utils.ContextKey

Some of the code, where nil is passed in place of integer, seems incorrect.

arindam2 commented 6 years ago

@jinzhu Could you take a look and help?

ttpcodes commented 6 years ago

I'm also encountering the issue on my end.

KernCheh commented 6 years ago

@arindam2 The last release for qor/qor is on the 27th of April 2016, which is very dated. Perhaps you would have to manually override qor and all its dependencies in your Gopkg.toml file.

[[override]]
  name = "github.com/qor/qor"
  branch = "master"
alexdor commented 5 years ago

@arindam2 here are all the overrides and the constrains that you will need for qor admin, qor and qor auth to work:

[[constraint]]
  name = "github.com/qor/admin"
  branch = "master"

[[constraint]]
  name = "github.com/qor/qor"
  branch = "master"
[[override]]
  name = "github.com/qor/roles"
  branch = "master"
[[constraint]]
  name = "github.com/qor/auth_themes"
  branch = "master"
[[override]]
  name="github.com/qor/render"
  branch="master"
[[override]]
  name="github.com/qor/i18n"
  branch = "master"
marceloboeira commented 5 years ago

@KernCheh why can't you just use GitHub releases properly with tags? it's quite hard to point to master and be forced to update the package on every build...

ZedYeung commented 5 years ago

@alexdor same here, with glide, set all dependencies to branch master, still not work. How to solve?

# vendor/github.com/qor/session/gorilla
../vendor/github.com/qor/session/gorilla/gorilla.go:26:12: undefined: utils.ContextKey
# vendor/github.com/qor/render
../vendor/github.com/qor/render/render.go:69:42: undefined: utils.AppRoot
../vendor/github.com/qor/render/render.go:70:55: undefined: utils.AppRoot
../vendor/github.com/qor/render/render.go:72:28: undefined: utils.GOPATH
../vendor/github.com/qor/render/render.go:93:42: undefined: utils.AppRoot
../vendor/github.com/qor/render/render.go:94:54: undefined: utils.AppRoot
../vendor/github.com/qor/render/render.go:96:28: undefined: utils.GOPATH
exit status 2
Process exiting with code: 1
ZedYeung commented 5 years ago

Already fixed it, in case somebody else also uses glide, just do this.

- package: github.com/qor/auth
  version: master
- package: github.com/qor/admin
  version: master
- package: github.com/qor/render
  version: master    
- package: github.com/qor/session
  version: master   
- package: github.com/qor/auth_themes
  version: master
- package: github.com/qor/i18n
  version: master
- package: github.com/qor/roles 
  version: master
- package: github.com/qor/qor 
  version: master

And set view paths

    Auth = auth.New(&auth.Config{
        DB:        gormDB,
        ViewPaths: []string{"vendor/github.com/qor/auth/views"},
    })