Live data from Hacker News

Air – Live reload when developing with Go

github.com

41–46 of 46 posts

Re: Air – Live reload when developing with Go

#41
post #8

I built something like this in Go a few years ago but it reloads your infrastructure when it changes, recompiles your code when it needs to, and syncs static files or interpreted files to wherever your app is running (desktop or cloud). Think of it like docker-compose but with file watching + sync + smart rebuilds. https://skaffold.dev/

How does it handle watch mode for compiled or built code?

It parses a Dockerfile (or queries dependencies in a tool like bazel) to get a list of file dependencies and then kicks off an optimized rebuild and redeploy. If you're using buildkit and caches this can be done really quickly (close to native compile without a Docker image)

You can tell it to just sync certain changes (e.g. syncing a javascript file to a container running webpack).

Re: Air – Live reload when developing with Go

#42

I've found it simple enough to start a goroutine to watch argv[0] and exec it if it's newer than the startup time of the process. Unlike other languages with insane build and link times, I've never needed this for Go. Builds are nearly instantaneous.

This doesn't watch the fs and build automatically now.. Does it? We started using this tool a couple of months ago. It was a huge productivity boost. We had multiple binaries produced by the build and all had to run to make the complete service

I usually run "go build" to see if my code compiles and respond to the errors. If it builds successfully, it's restarted automatically.

I personally don't see value in running "go build" out-of-band in another terminal where I can't easily pipe the errors into my editor (or automatically if I'm running it in the editor).

If that works for you, then great.

Re: Air – Live reload when developing with Go

#43
post #9

Earlier quoted context omitted.

That can’t handle file creation after the command is run, though, right?

I'm not sure about "find" -- but I also use "entr" for this (and just about a billion other tasks, is there anything you can't use it for?) and I personally do something like: ls src/**/*.filetype | entr -r -s "some command" And this will catch new files

How is it going to catch new files? ls runs once, doesn't it?

Re: Air – Live reload when developing with Go

#44
post #8

I built something like this in Go a few years ago but it reloads your infrastructure when it changes, recompiles your code when it needs to, and syncs static files or interpreted files to wherever your app is running (desktop or cloud). Think of it like docker-compose but with file watching + sync + smart rebuilds. https://skaffold.dev/

Skaffold makes bringing up and down a complex stack on Kubernetes a breeze. Thank you for an awesome tool!

Re: Air – Live reload when developing with Go

#45
post #30
post #26

Earlier quoted context omitted.

How would you write the tests to see if the RTL text is being displayed properly on the GUI when switching between LTR and RTL layout mode? How would you write the tests to see if the GLSL shader is displaying the mesh on the screen with the correct gamma correction factor?

I lnow you're saying that when it comes to GUIs you have to do it manually, but as someone working on the back-end this begs the question: is there no unit tests framework or anything for GUIs ?

There are, but nothing really satisfactory to be honest. GUI testing is still an unsolved problem in my book.
Post reply on HN