The use of global state means it isn't possible to start multiple servers in one process neatly. You might want to do this to serve http and https from the same process for instance, or two independent pieces of code can't be composed if they both use manners correctly.
Could we instead lose the "implicitly return 200" and say in the instructions that if you want to do asynchronous computation you should use a waitgroup yourself. This would be more idiomatic, I think, rather than hiding what is really happening. It would also obviate the need for global StartRoutine/FinishRoutine methods.
You could also have a GracefulHTTPHandler which requires a .Wait() method, which could be another way to do it (then the user could just embed a waitgroup on their handler type).
The use of global state means it isn't possible to start multiple servers in one process neatly. You might want to do this to serve http and https from the same process for instance, or two independent pieces of code can't be composed if they both use manners correctly.
Could we instead lose the "implicitly return 200" and say in the instructions that if you want to do asynchronous computation you should use a waitgroup yourself. This would be more idiomatic, I think, rather than hiding what is really happening. It would also obviate the need for global StartRoutine/FinishRoutine methods.
You could also have a
GracefulHTTPHandler
which requires a.Wait()
method, which could be another way to do it (then the user could just embed a waitgroup on their handler type).