go-bindata
includedir
go-bindata | includedir | |
---|---|---|
3 | 1 | |
325 | 81 | |
- | - | |
- | 10.0 | |
about 6 years ago | almost 4 years ago | |
Go | Rust | |
- | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
go-bindata
- A blog that is a single executable binary
-
TIL C99 has a string char limit of 4095.
Yeah, exactly. I’ve seen several programs which do this, usually as a way to avoid an expensive file read at startup (at the expense of a slightly larger binary). This Go library is a good example.
-
What is the preferred way to package static files (html/css/js) along with your standalone binary in 2020?
https://github.com/jteeuwen/go-bindata is the original go-bindata, but it is unmaintained, so there are several forks of it; IMO shuLhan/go-bindata is the best maintained, but go-bindata/go-bindata has the most stars because it has the best SEO-foo.
includedir
-
A blog that is a single executable binary
The bindata package that samhw linked goes further by walking a whole directory and embedding it all, supplying a function that maps from pathname to file contents. Looks like it returns an Option> though [1] which means it must be copying the file contents each time. I don't know why they didn't just return a &'static [u8] instead.
There's another crate includedir which looks more popular. It also supports compression. But if the file is stored in compressed form, looks like it also will (decompress/)copy into a fresh Vec, whether you request the uncompressed or compressed forms. [2] That's not what I would like.
I could use a high-quality implementation of this same idea. Personally I don't get using it for a personal blog (I'd rather be able to change the content without recompiling/restarting), but on my todo list is producing a zero-dependency, single-binary form of software I'm working on, including its web interface. I might end up writing my own.
[1] https://github.com/glassbearInc/rs-bindata/blob/93f61807b206...
[2] lines 59 and 80, respectively. https://github.com/tilpner/includedir/blob/6a81c906e233649af...
What are some alternatives?
go-embed - Generates go code to embed resource files into your library or executable
go-resources - Unfancy resources embedding for Go with out of box http.FileSystem support.
esc - A simple file embedder for Go
pcopy - pcopy is a temporary file host, nopaste and clipboard across machines. It can be used from the Web UI, via a CLI or without a client by using curl.
parcello - Golang Resource Bundler [deprecated]
httpfs - Collection of Go packages for working with the http.FileSystem interface.