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

panic: could not locate box "static" #5

Closed
come-maiz opened this issue Aug 7, 2017 · 2 comments
Closed

panic: could not locate box "static" #5

come-maiz opened this issue Aug 7, 2017 · 2 comments
Labels

Comments

@come-maiz
Copy link

Hello!

I'm trying to generate a snap package for this project using goreleaser. But I'm getting this error:

2017/08/07 10:26:05 main.go:53: initialized logger
2017/08/07 10:26:05 database.go:204: verifying access to db: store.db
2017/08/07 10:26:05 database.go:207: successfully verified access to db
panic: could not locate box "static"

goroutine 1 [running]:
github.com/GeertJohan/go%2erice.MustFindBox(0x97acad, 0x6, 0x11)
        /home/ubuntu/workspace/go/src/github.com/GeertJohan/go.rice/box.go:110+0x94
main.setupTmpl()
        /home/ubuntu/workspace/lrstanley/links.ml/templates.go:28 +0x3a
main.httpServer()
        /home/ubuntu/workspace/lrstanley/links.ml/http.go:29 +0x9c
main.main()
        /home/ubuntu/workspace/lrstanley/links.ml/main.go:99 +0x299

Snaps are the new packaging system that we are developing here at Ubuntu. They have a strong confinement, so the installed snap can only access the things allowed by the user. But I'm not sure what this "static" error could mean. Do you have any idea?

To try it in Ubuntu, extact the attached file and run:

sudo snap install *.snap --dangerous
linksml.links

linksml_0.2.2_amd64.zip

Here are my additions to the .goreleaser.yml file:
https://github.com/elopio/links.ml/blob/dc4d9488c3254d71bca2f6728b64365ee04ce97f/.goreleaser.yml#L20

@lrstanley
Copy link
Owner

lrstanley commented Aug 8, 2017

Hello,

tl;dr:

$ make generate

Sorry I didn't notice this earlier. The exception occurs when go-rice cannot find the static directory in either the actual filesystem, or in the generated rice-box.go (bindata-style embedded) file. This is likely occurring because you're running goreleaser directly, rather than through the Makefile, which means go-rice can only look for it in the filesystem, which is abstracted in snap packages. The Makefile runs make clean, fetch and generate before it actually calls the pre-defined goreleaser tasks, which generates the necessary files.

The solution would likely be to move those commands into the pre hooks within the goreleaser file, however I originally opted not to do this, as the Makefile seemed like the more appropriate place for hooks of that kind, since it's a more common entry point for people trying to build and install FOSS software (and so they don't necessarily have to become familiar with go-specific tooling).

So, a user could simply run:

$ make release

or:

$ make snapshot

If you think it's more appropriate to add the hooks to the goreleaser configuration file, it probably wouldn't hurt if the generate call is ran twice.

@come-maiz
Copy link
Author

Awesome @lrstanley. So this was actually ready, I generated the snap with make release and could start the server. Thanks a lot for your guidance.

I proposed it in #6.

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

No branches or pull requests

2 participants