Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when build assets (templates,etc) into the binary #124

Open
BERA opened this issue Feb 9, 2018 · 2 comments
Open

Error when build assets (templates,etc) into the binary #124

BERA opened this issue Feb 9, 2018 · 2 comments

Comments

@BERA
Copy link

BERA commented Feb 9, 2018

Hi I'm following the instructions here https://doc.getqor.com/guides/bindatafs.html with a project with the layout below
selection_040

I initialized bindata as a following

bindatafs config/bindatafs

Initializing BindataFS...
copy from /home/user/go/src/github.com/qor/bindatafs/templates to config/bindatafs

After I changed the source code as requested.

selection_041

selection_041

And when I tried to compile the templates into the binary I got the error below

~/go/src/github.com/user/CtrlCollectors$ go run -tags 'bindatafs' main.go

github.com/user/CtrlCollectors/config/bindatafs

config/bindatafs/bindatafs.go:80: undefined: _bindata
config/bindatafs/bindatafs.go:81: undefined: Asset
config/bindatafs/bindatafs.go:87: undefined: _bindata
config/bindatafs/bindatafs.go:88: undefined: _bindata
config/bindatafs/bindatafs.go:224: undefined: _bindata
config/bindatafs/bindatafs.go:225: undefined: Asset
config/bindatafs/bindatafs.go:231: undefined: _bindata
config/bindatafs/bindatafs.go:233: undefined: _bindata

after running without tags I received the message below
go run main.go
Compiling templates...

I got my final project structure/files

selection_044

Then build the project

go build -tags enterprise main.go

OR

go build main.go

But when running I get the message below
./main
Compiling templates...

Before my error message was similar to the following issues

#56 #87 #33 #88

Also, the approach informed by @fengde didn't work either @jaytaylor

Guys, QOR is really nice framework but the documentation about deployment could be improved, this kind of error is a pain in the ass and could be easier to define a project structure and make EXPLICIT commands and instructions for build binary with the assets.

Or I really missing an obvious step

Thanks a lot.

@cryptix
Copy link

cryptix commented Feb 9, 2018

The two steps to make bindatafs work should be:

  1. trigger the Compile() function. In qor-example this is done with the --compile-templates flag.

This should create new go code under config/admin/bindatafs with the embedded files.

  1. build your server with the bindata tag.

@MohitKS5
Copy link

MohitKS5 commented May 15, 2020

The binary created still doesn't work standalone. Atleast when I run on nginx.
EDIT: It will work if $uri exactly matches the $uri the admin is mounted on. You can't proxy pass with an ending slash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants