4 ms·
It's sad https://pkg.go.dev/embed https://pkg.go.dev/embed was not mentioned in a post about web development in Go :-) Having a true single binary bundling you
by yegle 2y ago
It's sad https://pkg.go.dev/embed https://pkg.go.dev/embed was not mentioned in a post about web development in Go :-)
Having a true single binary bundling your static resources is so convenient.
- okibry 2y agoWhich time golang read file, build time or run time ?
- estebarb 2y agoBuild time. It literally embeeds the file in the binary.
- catlifeonmars 2y agoBuild time
- nasretdinov 2y agoembed package allows to embed assets directly into the binary, so the files are read once during build time and then you can access them as e.g. a byte slice, a string, or a special FS object that acts like an in-memory file system
- deleted 2y ago[deleted]
- dullcrisp 2y agoIt is mentioned now.
- linhns 2y agoMassively underrated. It's actually used to build the pkg.go.dev website itself. https://github.com/golang/pkgsite https://github.com/golang/pkgsite
- avinassh 2y agoit does mention it: there’s just 1 static binary, all I need to do to deploy it is copy the binary. If there are static files I can just embed them in the binary with embed.