Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go file.
I usually use tests when I add/change some features in my application, so I don’t need to refresh the browser to check if everything works.
But when I change simple things, or maybe some templates, I need to stop the server, build and restart. It’s not a big deal since
go build is really fast,
but I wanted to automate this process with Fresh.
Instead of running the application directly, I run
fresh inside the app folder. Every time I create/modify/delete a file, Fresh runs
go build and restarts the application.
If the build command returns an error, it will log the error message in the tmp folder. If the framework you are using supports Fresh, it can show that error in the browser.
Traffic already supports it. If you run a Traffic app with Fresh, Traffic automatically add a Middleware that shows the build errors if an error log file exists.
Anyway Fresh is not part of Traffic, and you can use it with any other framework that supports some kind of middleware.
In the _example folder there is an example app using Martini
where I created a simple middleware that uses some functions from
I made the same for gocraft/web.
In the pilu-martini folder there is another example using a modified version of Martini that already uses the runner lib.
Check the repository on Github for more informations, and feel free to send me a pull request.