4 ms·
So happy to see file embedding move to the stdlib. Having _everything_ in a single binary makes distribution so much easier. As an aside, I would love to see
by candiddevmike 6y ago
So happy to see file embedding move to the stdlib. Having _everything_ in a single binary makes distribution so much easier.
As an aside, I would love to see Go have first class support for watch/hot reload while developing...! (e.g. go run --watch main.go)
- Meekro 6y agoI have a small project that uses Go's built-in webserver libs to display a status page. I've been storing the HTML/CSS for that in Go strings, which breaks color formatting in my editor and generally feels ugly. This embedding approach looks awesome, I can't wait to give it a try!
- coder543 6y agoThis is by far the best tool for the job that I've found: https://github.com/cortesi/modd https://github.com/cortesi/modd
- jbub 6y agoI second that
- leg100 6y agoIn tandem with https://github.com/cortesi/devd https://github.com/cortesi/devd I've found it a good setup for web development. Modd watches file changes and rebuilds, while Devd enables livereload, letting me make changes in my text editor and then see the rendered changes in the browser, side-by-side, in near real-time. This is for go web development but I'm pretty sure these two tools are language-agnostic.
- papaf 6y agoI would love to see Go have first class support for watch/hot reload while developing Its not first class, but I have been happy using reflex [1] for non-http and gin [2] for http. Combined with Go's fast compile they work as well as a hot reload. [1] https://github.com/cespare/reflex https://github.com/cespare/reflex [2] https://github.com/codegangsta/gin https://github.com/codegangsta/gin
- silasb 6y agoI've been using https://github.com/cosmtrek/air https://github.com/cosmtrek/air
- SamWhited 6y agoThis should be pretty straight forward without special support. Do the embedding and create a function that returns the fs.FS with your files in it. Put that in a file with a build tag or something, // +build !dev and then put the same function that returns an fs.FS that points at the filesystem in another file and add the build tag // +build dev or something along those lines. Now you can do go build -tags dev to get the filesystem versions, or build normally to get the "release" version where it's embedded.
- bartekrutkowski 6y agoShameless self plug, but I've had that itch and decided to scratch it with a tool[0] that would be universal and not limited to Go - albeit written in it ;) [0] https://github.com/bartekrutkowski/watchr https://github.com/bartekrutkowski/watchr
- cirwin 6y agoTo do this well (for servers, which is the most common case) you need to keep the port open (and delay requests while recompilation is in progress) or clients can see transient errors. So it's probably not a language level concern, but a protocol level one (it's very solvable for HTTP for example). I built https://github.com/superhuman/lrt https://github.com/superhuman/lrt which tries to solve this problem in a go-like way (no configuration required, minimal log noise, and reliability/simplicity as the primary design goals) for Superhuman.
- CGamesPlay 6y agoObviously there's lots of candidates here. I've recently switched from entr or fswatch to watchexec [0], because it can restart a server, so something like this gets me where I need to be: watchexec -cr "make && my-server" [0] https://github.com/watchexec/watchexec https://github.com/watchexec/watchexec