profile
viewpoint

Ask questionsMake sure ServeMux is used in the right order

The ServeMux construction goes through phases:

  1. Plugin registration
  2. Handlers registration and configuration
  3. Execution

Nothing that is done in one of the phases should be done in one of the others.

I think we should enforce this somehow, by either providing builders for the phases or panicking if something is done out of order at startup, and then ignoring what happens at runtime (e.g. registering a plugin or a handler after a request has been served will log an error and do nothing).

google/go-safeweb

Answer questions bsiegert

In Goa, we have state variables that we set and check with atomics and return an error if in the wrong phase. For instance, if you want to add a module to a running server, it will be rejected this way.

useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List