From 0f015d75d2c74f5f6b8c188d16bb3175802522fa Mon Sep 17 00:00:00 2001 From: cnphpbb Date: Wed, 12 Mar 2014 16:50:13 +0800 Subject: [PATCH] Update beego.go - Modify GroupRouters all function Modify the file beego.go. Type GroupRouters all function Slice types exist trap bug. --- beego.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/beego.go b/beego.go index 29cd45a0..1d5aa678 100644 --- a/beego.go +++ b/beego.go @@ -28,12 +28,12 @@ type GroupRouters []groupRouter // Get a new GroupRouters func NewGroupRouters() GroupRouters { - return make([]groupRouter, 0) + return make(GroupRouters, 0) } // Add Router in the GroupRouters // it is for plugin or module to register router -func (gr GroupRouters) AddRouter(pattern string, c ControllerInterface, mappingMethod ...string) { +func (gr *GroupRouters) AddRouter(pattern string, c ControllerInterface, mappingMethod ...string) { var newRG groupRouter if len(mappingMethod) > 0 { newRG = groupRouter{ @@ -48,16 +48,16 @@ func (gr GroupRouters) AddRouter(pattern string, c ControllerInterface, mappingM "", } } - gr = append(gr, newRG) + *gr = append(*gr, newRG) } -func (gr GroupRouters) AddAuto(c ControllerInterface) { +func (gr *GroupRouters) AddAuto(c ControllerInterface) { newRG := groupRouter{ "", c, "", } - gr = append(gr, newRG) + *gr = append(*gr, newRG) } // AddGroupRouter with the prefix