-
-
Notifications
You must be signed in to change notification settings - Fork 196
Calling packr build/install
with a *.go
files causes boxes not to be packed
#75
Comments
Ok so turns out you can't really use any flag you want with
Then the files are not found. Binary seems to build fine until another machine tries to run it. Server runs fine, just the static assets are not there. Seems that with the flag, However:
Works! Unclear if the language in the README needs to be updated or not, but this took me for quite the spin 😂 Here is an example I use: if [[ -d build ]]
then
rm -rf build
fi
if [[ -d releases ]]
then
rm -rf releases
fi
npm run build \
&& mkdir releases \
&& GOOS=darwin GOARCH=amd64 packr build && mv ./hmrcmd ./releases/darwin-hmrcmd \
&& GOOS=linux GOARCH=amd64 packr build && mv ./hmrcmd ./releases/linux-hmrcmd \
&& GOOS=linux GOARCH=arm GOARM=5 packr build && mv ./hmrcmd ./releases/rpi-hmrcmd \
&& GOOS=windows GOARCH=386 packr build && mv ./hmrcmd.exe ./releases/hmrcmd.exe \
&& packr clean Seems to do the trick 🎉 |
I think I'm running into a similar problem trying to package something for a raspberry pi. Your mv fix isn't working for me. Fixed with https://github.com/rakyll/statik |
Interesting. I haven't tried on the rpi yet 🤔 Thanks for bringing it up! |
Yeah, and just to be clear, I didn't mean to imply the other lib is better or anything. I just needed something working by tomorrow, so after an hour debugging I was open to seeing if anything else "just worked". |
@selfup please make sure you are using the latest version. Also, when I tried to build it wouldn't because you were asking for If the issue persists with the latest version of packr, please re-open. Thanks. |
@markbates I did As laid out in my snippet here: if [[ -d build ]]
then
rm -rf build
fi
if [[ -d releases ]]
then
rm -rf releases
fi
npm run build \
&& mkdir releases \
&& GOOS=darwin GOARCH=amd64 packr build && mv ./hmrcmd ./releases/darwin-hmrcmd \
&& GOOS=linux GOARCH=amd64 packr build && mv ./hmrcmd ./releases/linux-hmrcmd \
&& GOOS=linux GOARCH=arm GOARM=5 packr build && mv ./hmrcmd ./releases/rpi-hmrcmd \
&& GOOS=windows GOARCH=386 packr build && mv ./hmrcmd.exe ./releases/hmrcmd.exe \
&& packr clean It's all good, at least this issue is here with a fix so people know what to do when they run into this as well 🙏 |
I too experienced this bug. The -o command seems to mess up the whole building process for some reason. @selfup your workaround saved me so much time, but doesn't actually solve the issue itself. This Dockerfile command works: RUN go get -u github.com/gobuffalo/packr/... && \
cd ./server && \
CGO_ENABLED=0 GOOS=linux packr build -a -installsuffix cgo && ls && mv ./server /src/bin/GoReactBootstrap && ls /src/bin/ While this does not work: RUN go get -u github.com/gobuffalo/packr/... && \
cd ./server && \
CGO_ENABLED=0 GOOS=linux packr build -a -installsuffix cgo -o /src/bin/GoReactBootstrap main.go The difference is that I specified the output file with -o and the entry file main.go. @markbates: Since the snippets use the latest version of packr, can you reopen the issue please? |
@marhaupe glad it saved you time 😄 While not a fix, at least it's documented and indexed for those running into this as well. Thanks for the re-open 🙏 |
If anyone needs some test data: The snippet above can be found at https://github.com/marhaupe/GoReactBootstrap/blob/master/Dockerfile. packr version number at the time this didn't work was v1.13.2. |
packr build/install
with a *.go
files causes boxes not to be packed
I've updated the ticket title, since the cause of this issue is now known. The problem is actually that when calling The solution, until a "fix" can be found, is to call |
Thanks for the update! |
I believe this PR solves this issue https://github.com/gobuffalo/packr/pull/94/files I would love those affected by this issue could try it out. |
I compiled the binary in your "small-fixes" branch with
still won't produce the desired result. But to be completely honest, I'm not exactly sure if I compiled the binary correctly. Feel free to use the repo to reproduce the issue or give me a heads up on what I did wrong. |
I don't mind using If that's how it's going to be we should add a section to the README or something? Otherwise we can continue to help 😄 Would be neat once the behavior is seamless Thanks for the updates @marhaupe 🙏 |
@marhaupe thanks for trying. Question, did you compile the binary under the v2 folder or the root folder? I just want to make sure you tried with v2, and not just v1. I’ll try your repo and see if I can figure it out. @selfup adding a note to the README about how Go works in those situations is a great. PR? |
Yea I can make one in a bit! Errands and stuff this morning. 👍 |
@markbates I only compiled it for v1. Compiling it for v2 outputs the following error messages, but that is most likely due to a mistake on my side:
To compile the binary, I ran |
Go modules are screwing you up. You have to turn them off because it’s an unreleased branch and go modules can’t resolve it.
There’s a make install command in the v2 for compiling it.
But you’re app can’t use go modules while you’re testing any package that isn’t officially released yet. They haven’t done a good job with that part of the dev flow at all yet.
I can tell you I tried to build your repo using the v2 binary and it worked with the latest commit of that branch.
…On Sep 22, 2018, 11:50 AM -0400, Marcel Haupenthal ***@***.***>, wrote:
@markbates I only compiled it for v1. Compiling it for v2 outputs the following error messages, but that is most likely due to a mistake on my side:
cannot find package "github.com/gobuffalo/packr/v2"
cannot find package "github.com/gobuffalo/packr/v2/file/resolver"
To compile the binary, I ran GO111MODULE=on go get && GOOS=linux go build from the ./v2/packr folder. Am I missing something?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
PR is up #95 🎉 |
This should be fixed in v2. Closing this issue for now. Please re-open if the problem still persists with v2. |
Hey so this is a longshot..
I am using
packr
to compile static assets to a single go binary.It's a webserver. I can move the exe around on my machine and it works.
However when someone else on a different windows machine tries it, it says 404 not found :thinking_face:
Haven't tried on Mac yet, but I guess I would run into the same issues 😂
Here is my repo: https://github.com/selfup/hmrcmd
Any help would be awesome! 🙏
The text was updated successfully, but these errors were encountered: