Go: How to combine two (or more) http.ServeMux?
问题 Given that you have two instances of http.ServeMux , and you wish for them to be served at the same port number, like so: muxA, muxB http.ServeMux //initialise muxA //initialise muxB combinedMux := combineMux([muxA, muxB]) http.ListenAndServe(":8080", combinedMux) How would one go about writing the combinedMux function, as described above? ... or is there an alternative way to accomplish the same thing? 回答1: Because an http.ServeMux is also an http.Handler you can easily nest one mux inside