auth icon indicating copy to clipboard operation
auth copied to clipboard

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

Open arindam2 opened this issue 6 years ago • 7 comments

  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 avatar Aug 29 '18 10:08 arindam2

@jinzhu Could you take a look and help?

arindam2 avatar Aug 29 '18 16:08 arindam2

I'm also encountering the issue on my end.

ttpcodes avatar Sep 08 '18 18:09 ttpcodes

@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"

KernCheh avatar Oct 06 '18 05:10 KernCheh

@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"

alexdor avatar Jan 08 '19 09:01 alexdor

@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...

marceloboeira avatar Jan 22 '19 13:01 marceloboeira

@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 avatar Jan 26 '19 00:01 ZedYeung

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"},
	})

ZedYeung avatar Jan 26 '19 18:01 ZedYeung