A packager module/tool to pack templates/static files with the binary and extract it at the runtime.
You can import this as a module and start using it.
go get github.com/cipheras/gopkgr
Or you can either use a precompiled binary package for your architecture or you can compile gopkgr from the source.
Windows | Linux |
---|---|
win-x64 | linux-x64 |
For other versions or releases go to release page.
In order to compile from source, make sure you have installed GO of version at least 1.15.0 (get it from here). When you have GO installed, type in the following:
go build
Running gopkgr will generate a GO file which will contain data from all packed files.
Note: This file can become big if there are too many static files. Don't include images.
Put the binary in the same dir in which the files which are to be packed are located and execute it.
It will automatically pack all files and files that are in folders and subfolders too.
Now you can use this file with your GO project and use unpacker function to unpack it at runtime. Call function in your code like,
err := unpkr(dir)
You can give path to where it should be extracted at the runtime.
Finally build your project.
gopkgr is made by @cipheras and is released under the terms of the
Feel free to submit a bug, add features or issue a pull request.