mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-23 20:02:22 +00:00
Update ch5-03-middleware.md
修复5.3.3 示例代码 nil map panic: assignment to entry in nil map
This commit is contained in:
parent
d55969d945
commit
0c87b968aa
@ -233,8 +233,10 @@ type Router struct {
|
|||||||
mux map[string] http.Handler
|
mux map[string] http.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRouter() *Router{
|
func NewRouter() *Router {
|
||||||
return &Router{}
|
return &Router{
|
||||||
|
mux: make(map[string]http.Handler),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Router) Use(m middleware) {
|
func (r *Router) Use(m middleware) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user