Skip to content

Commit

Permalink
golint
Browse files Browse the repository at this point in the history
  • Loading branch information
astaxie committed Apr 29, 2017
1 parent 1c32c01 commit ea3d069
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
// PolicyFunc defines a policy function which is invoked before the controller handler is executed.
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 {
var urlPath = cont.Input.URL()
if !BConfig.RouterCaseSensitive {
Expand Down Expand Up @@ -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) {
BeeApp.Handlers.addToPolicy(method, pattern, policy...)
}
Expand Down
1 change: 1 addition & 0 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ func DelStaticPath(url string) *App {
return BeeApp
}

// AddTemplateEngine add a new templatePreProcessor which support extension
func AddTemplateEngine(extension string, fn templatePreProcessor) *App {
AddTemplateExt(extension)
beeTemplateEngines[extension] = fn
Expand Down
4 changes: 2 additions & 2 deletions template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ var add = `{{ template "layout_blog.tpl" . }}
<script src="/static/js/current.js"></script>
{{ end}}`

var layout_blog = `<!DOCTYPE html>
var layoutBlog = `<!DOCTYPE html>
<html>
<head>
<title>Lin Li</title>
Expand Down Expand Up @@ -231,7 +231,7 @@ func TestTemplateLayout(t *testing.T) {
if k == 0 {
f.WriteString(add)
} else if k == 1 {
f.WriteString(layout_blog)
f.WriteString(layoutBlog)
}
f.Close()
}
Expand Down
6 changes: 3 additions & 3 deletions templatefunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,9 @@ func parseFormTag(fieldT reflect.StructField) (label, name, fType string, id str
class = fieldT.Tag.Get("class")

required = false
required_field := fieldT.Tag.Get("required")
if required_field != "-" && required_field != "" {
required, _ = strconv.ParseBool(required_field)
requiredField := fieldT.Tag.Get("required")
if requiredField != "-" && requiredField != "" {
required, _ = strconv.ParseBool(requiredField)
}

switch len(tags) {
Expand Down

0 comments on commit ea3d069

Please sign in to comment.