Merge pull request #10 from huacnlee/fix_add_func_map_method
Fix a wrong logical for AddFuncMap method.
Showing
1 changed file
with
4 additions
and
5 deletions
| ... | @@ -3,9 +3,8 @@ package beego | ... | @@ -3,9 +3,8 @@ package beego |
| 3 | //@todo add template funcs | 3 | //@todo add template funcs |
| 4 | 4 | ||
| 5 | import ( | 5 | import ( |
| 6 | //"fmt" | 6 | "fmt" |
| 7 | "errors" | 7 | "errors" |
| 8 | "fmt" | ||
| 9 | "github.com/russross/blackfriday" | 8 | "github.com/russross/blackfriday" |
| 10 | "html/template" | 9 | "html/template" |
| 11 | "strings" | 10 | "strings" |
| ... | @@ -88,8 +87,8 @@ func Compare(a, b interface{}) (equal bool) { | ... | @@ -88,8 +87,8 @@ func Compare(a, b interface{}) (equal bool) { |
| 88 | // AddFuncMap let user to register a func in the template | 87 | // AddFuncMap let user to register a func in the template |
| 89 | func AddFuncMap(key string, funname interface{}) error { | 88 | func AddFuncMap(key string, funname interface{}) error { |
| 90 | if _, ok := beegoTplFuncMap[key]; ok { | 89 | if _, ok := beegoTplFuncMap[key]; ok { |
| 91 | beegoTplFuncMap[key] = funname | 90 | return errors.New("funcmap already has the key") |
| 92 | return nil | ||
| 93 | } | 91 | } |
| 94 | return errors.New("funcmap already has the key") | 92 | beegoTplFuncMap[key] = funname |
| 93 | return nil | ||
| 95 | } | 94 | } | ... | ... |
-
Please register or sign in to post a comment