I have the following piece of code, that serves static files from a static files directory (staticFilesDir):
for _, prefix := range []string{"css", "img", "js", "static"} {
prefix = "/" + prefix + "/"
fs := http.FileServer(http.Dir(staticFilesDir + prefix))
r.PathPrefix(prefix).Handler(http.StripPrefix(prefix, fs))
}
This directory changes from time to time, and currently I always need to restart the server process to use the new value.
How can I reconfigure/reload the FileServer without restarting the whole process?
Additional complication to that: other handlers of the http server are executing long-running jobs (incl. child processes etc.), that I would like to keep untouched during this reload.
What is the standard solution of this quite typical task?