Restart Go's net/http server on file-change like Django

user1467267 picture user1467267 · Jan 29, 2014 · Viewed 9.8k times · Source

I'm trying out Martini, which adds some nice functionality upon Go's basic net/http package.

I was wondering tho. How can I, like Django does too, let the server restart itself on source-file changes? I know how to monitor a file, but I'm not sure how to retrigger the Server within the same process.

I'm guessing to trigger http.ListenAndServe again, but I have a feeling it doesn't go well with instance already running.

Do I need to spawn a subprocess/daemon to get this working?

Answer

Adrian picture Adrian · Jan 30, 2014

Maybe you need gin ?

Made by the creator of Martini.