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

Add ability to package static content into the binary. #69

Closed
vrongmeal opened this issue Nov 9, 2020 · 1 comment · Fixed by #75
Closed

Add ability to package static content into the binary. #69

vrongmeal opened this issue Nov 9, 2020 · 1 comment · Fixed by #75
Labels
discussion enhancement New feature or request

Comments

@vrongmeal
Copy link
Contributor

vrongmeal commented Nov 9, 2020

For this, it's much better to write a script that produces a blob file that includes the contents of all the files.

https://github.com/phogolabs/parcello seems to fit nicely for this purpose. golang/go#35950 (comment) on the discussion thread nicely layouts many other options so we can let this be open for discussion for which option to chose.

@vrongmeal vrongmeal added enhancement New feature or request discussion labels Nov 9, 2020
@vrongmeal
Copy link
Contributor Author

The reasoning for using https://github.com/phogolabs/parcello:

  • Easier to understand.
  • It implements the Go native interfaces (http.FileSystem, etc.).
  • Has better documentation compared to many other options.
  • Writing a custom script for go generate for this is easier compared to others.

vrongmeal added a commit that referenced this issue Nov 12, 2020
This is possible by generating a zipped blob of `static` directory into a
Go file, precisely, `pkg/static/resources.go`. This file can be generated
using `make static` command.

Fixes #69

Signed-off-by: Vaibhav <[email protected]>
vrongmeal added a commit that referenced this issue Nov 12, 2020
Now files can be accessed through the `NewFS` method of the static
package and when run in debug mode, i.e., with "DEBUG" environment
variable set to "on", there is no requirement of packing files
inside resources.go and the build will run just fine from the root
directory.

Fixes #69

Signed-off-by: Vaibhav <[email protected]>
murex971 pushed a commit that referenced this issue Nov 13, 2020
This is possible by generating a zipped blob of `static` directory into a
Go file, precisely, `pkg/static/resources.go`. This file can be generated
using `make static` command.

Fixes #69

Signed-off-by: Vaibhav <[email protected]>
murex971 pushed a commit that referenced this issue Nov 13, 2020
Now files can be accessed through the `NewFS` method of the static
package and when run in debug mode, i.e., with "DEBUG" environment
variable set to "on", there is no requirement of packing files
inside resources.go and the build will run just fine from the root
directory.

Fixes #69

Signed-off-by: Vaibhav <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant