Hacker News new | ask | show | jobs
by keda 4582 days ago
Unlike Revel, you don't seem to have watch setup for .go files, which make sense since you want to keep it smallish. Curious on how other gopher trigger app restart from their editor of choice. Anyone have insight for setting up VIM+Tmux for Golang development that enable app restart from single key press? Sample .vimrc will be great.
4 comments

I use Grunt [1] and (especially) grunt-contrib-watch [2] for this. Using Grunt also has the benefit of automatically recompiling CSS files and/or concatenating JS files etc. But your mileage may vary, of course.

[1] http://gruntjs.com/ [2] https://github.com/gruntjs/grunt-contrib-watch

I totally built a watcher command line app and ditched it because this was more convenient :)

https://github.com/codegangsta/dotfiles/blob/master/vim/vim/...

Adding a watch system is not very complicate using `fsnotify`, I've done it for a toy blog app, so that it watches the `/posts/` folder for new Markdown, and the `/templates/` folder for modified templates.

I've even made it rewrite (eradicate) templates that don't compile (threats).

https://github.com/aybabtme/brog/blob/master/brogger/templat...

At this point, the code is kind of messy, so please overlook that. I also have a bare deployment on an t1.micro : http://www.antoine.im/

Recompiling and restarting the server has yet to become a bottleneck in development for me, or at least it hasn't caused enough friction or irritation to compel me to add something using fsnotify or other solutions. If you told me that you were very interested in using the framework but the lack of this feature was a barrier to adoption, I'd definitely think harder about it.
I write plain handlefuncs, but so far I have a pretty easy to remember command to restart the server for local development (works as well in Acme, where I'm writing most of my go code as in emacs, where I write templates and vim, where I usually just make really quick edits.) It's Cmd-Tab C-c [up] enter.

Just trying to express the same redneckbeard said: until it is a very thin bottleneck, this should be no problem.

I've recently used Russ Cox's devweb for this:

https://code.google.com/p/rsc/source/browse/devweb/