func main { r := gin.Default() //获取所有路由 r.GET("getRouters", func(c *gin.Context) { routers := r.Routes() for _, v := range routers { fmt.Println( v.Method) fmt.Println( v.Path) } })}