mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 07:40:54 +00:00
golint
This commit is contained in:
parent
1c32c011a1
commit
ea3d0690cf
@ -23,7 +23,7 @@ import (
|
|||||||
// PolicyFunc defines a policy function which is invoked before the controller handler is executed.
|
// PolicyFunc defines a policy function which is invoked before the controller handler is executed.
|
||||||
type PolicyFunc func(*context.Context)
|
type PolicyFunc func(*context.Context)
|
||||||
|
|
||||||
// FindRouter Find Router info for URL
|
// FindPolicy Find Router info for URL
|
||||||
func (p *ControllerRegister) FindPolicy(cont *context.Context) []PolicyFunc {
|
func (p *ControllerRegister) FindPolicy(cont *context.Context) []PolicyFunc {
|
||||||
var urlPath = cont.Input.URL()
|
var urlPath = cont.Input.URL()
|
||||||
if !BConfig.RouterCaseSensitive {
|
if !BConfig.RouterCaseSensitive {
|
||||||
@ -71,7 +71,7 @@ func (p *ControllerRegister) addToPolicy(method, pattern string, r ...PolicyFunc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register new policy in beego
|
// Policy Register new policy in beego
|
||||||
func Policy(pattern, method string, policy ...PolicyFunc) {
|
func Policy(pattern, method string, policy ...PolicyFunc) {
|
||||||
BeeApp.Handlers.addToPolicy(method, pattern, policy...)
|
BeeApp.Handlers.addToPolicy(method, pattern, policy...)
|
||||||
}
|
}
|
||||||
|
@ -365,6 +365,7 @@ func DelStaticPath(url string) *App {
|
|||||||
return BeeApp
|
return BeeApp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddTemplateEngine add a new templatePreProcessor which support extension
|
||||||
func AddTemplateEngine(extension string, fn templatePreProcessor) *App {
|
func AddTemplateEngine(extension string, fn templatePreProcessor) *App {
|
||||||
AddTemplateExt(extension)
|
AddTemplateExt(extension)
|
||||||
beeTemplateEngines[extension] = fn
|
beeTemplateEngines[extension] = fn
|
||||||
|
@ -159,7 +159,7 @@ var add = `{{ template "layout_blog.tpl" . }}
|
|||||||
<script src="/static/js/current.js"></script>
|
<script src="/static/js/current.js"></script>
|
||||||
{{ end}}`
|
{{ end}}`
|
||||||
|
|
||||||
var layout_blog = `<!DOCTYPE html>
|
var layoutBlog = `<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Lin Li</title>
|
<title>Lin Li</title>
|
||||||
@ -231,7 +231,7 @@ func TestTemplateLayout(t *testing.T) {
|
|||||||
if k == 0 {
|
if k == 0 {
|
||||||
f.WriteString(add)
|
f.WriteString(add)
|
||||||
} else if k == 1 {
|
} else if k == 1 {
|
||||||
f.WriteString(layout_blog)
|
f.WriteString(layoutBlog)
|
||||||
}
|
}
|
||||||
f.Close()
|
f.Close()
|
||||||
}
|
}
|
||||||
|
@ -507,9 +507,9 @@ func parseFormTag(fieldT reflect.StructField) (label, name, fType string, id str
|
|||||||
class = fieldT.Tag.Get("class")
|
class = fieldT.Tag.Get("class")
|
||||||
|
|
||||||
required = false
|
required = false
|
||||||
required_field := fieldT.Tag.Get("required")
|
requiredField := fieldT.Tag.Get("required")
|
||||||
if required_field != "-" && required_field != "" {
|
if requiredField != "-" && requiredField != "" {
|
||||||
required, _ = strconv.ParseBool(required_field)
|
required, _ = strconv.ParseBool(requiredField)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch len(tags) {
|
switch len(tags) {
|
||||||
|
Loading…
Reference in New Issue
Block a user