我正在尝试合并多个切片,如下所示,
package routes
import (
"net/http"
)
type Route struct {
Name string
Method string
Pattern string
Secured bool
HandlerFunc http.HandlerFunc
}
type Routes []Route
var ApplicationRoutes Routes
func init() {
ApplicationRoutes = append(
WifiUserRoutes,
WifiUsageRoutes,
WifiLocationRoutes,
DashboardUserRoutes,
DashoardAppRoutes,
RadiusRoutes,
AuthenticationRoutes...
)
}
然而,内置的 append() 能够附加两个切片,因此它会在编译时抛出太多参数来附加。是否有替代功能来完成任务?还是有更好的方法来合并切片?
慕标5832272
梦里花落0921
相关分类