gobuffalo / packr

The simple and easy way to embed static files into Go binaries.
MIT License
3.41k stars 196 forks source link

Packr2 is only working when used on same machine the binary built #152

Open h7kanna opened 5 years ago

h7kanna commented 5 years ago

Hi, I updated to packr2 today after v2.0.0 release.

When I do packr2 install.. the generated binary works my machine. But it is not working on other machines. It says stat /Users/harsha/Downloads/packr2test_0.0.1_darwin_amd64/templates/admin/index.html: no such file or directory

Sample usage taken from packr2 READme.

https://github.com/h7kanna/packr2test

Built binary. https://github.com/h7kanna/packr2test/releases

Daavidaviid commented 5 years ago

@h7kanna you found a solution ? I'm stuck with the same issue. See -> #181

ghost commented 5 years ago

Any news about this? I have the same problem

pierresantana commented 5 years ago

I was taking a look in this problem and I discovered that the problem is related to how packr2 is doing their magic. To work properly, you should compile your code using packr2 install, that generate a temp code with the static content converted to hexadecimal and then run go install to build the app. When using go install (or, in this case, goreleaser) it will compile your code without doing this conversion.

@h7kanna just for testing purposes, if you remove the line with @packr2 clean from you Makefile and change the command gorelease --skip-validate --rm-dist it will work properly.

@markbates do you have any idea how we can solve this problem?

graywolf336 commented 5 years ago

I just ran into this issue myself and can't figure out how to work around this..