Commit ce332713 authored by 傅小黑's avatar 傅小黑

gofmt commented go files

parent b459cf23
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"github.com/astaxie/beego/context" "github.com/astaxie/beego/context"
) )
// FitlerFunc defines filter function type. // FilterFunc defines filter function type.
type FilterFunc func(*context.Context) type FilterFunc func(*context.Context)
// App defines beego application with a new PatternServeMux. // App defines beego application with a new PatternServeMux.
......
...@@ -127,7 +127,7 @@ func init() { ...@@ -127,7 +127,7 @@ func init() {
UseFcgi = false UseFcgi = false
MaxMemory = 1<<26 //64MB MaxMemory = 1 << 26 //64MB
EnableGzip = false EnableGzip = false
......
...@@ -144,15 +144,15 @@ func (c *Controller) RenderBytes() ([]byte, error) { ...@@ -144,15 +144,15 @@ func (c *Controller) RenderBytes() ([]byte, error) {
//if the controller has set layout, then first get the tplname's content set the content to the layout //if the controller has set layout, then first get the tplname's content set the content to the layout
if c.Layout != "" { if c.Layout != "" {
if c.TplNames == "" { if c.TplNames == "" {
c.TplNames = strings.ToLower(c.controllerName)+"/"+strings.ToLower(c.actionName)+"." + c.TplExt c.TplNames = strings.ToLower(c.controllerName) + "/" + strings.ToLower(c.actionName) + "." + c.TplExt
} }
if RunMode == "dev" { if RunMode == "dev" {
BuildTemplate(ViewsPath) BuildTemplate(ViewsPath)
} }
newbytes := bytes.NewBufferString("") newbytes := bytes.NewBufferString("")
if _, ok := BeeTemplates[c.TplNames]; !ok { if _, ok := BeeTemplates[c.TplNames]; !ok {
panic("can't find templatefile in the path:"+c.TplNames) panic("can't find templatefile in the path:" + c.TplNames)
return []byte{}, errors.New("can't find templatefile in the path:"+c.TplNames) return []byte{}, errors.New("can't find templatefile in the path:" + c.TplNames)
} }
err := BeeTemplates[c.TplNames].ExecuteTemplate(newbytes, c.TplNames, c.Data) err := BeeTemplates[c.TplNames].ExecuteTemplate(newbytes, c.TplNames, c.Data)
if err != nil { if err != nil {
...@@ -171,15 +171,15 @@ func (c *Controller) RenderBytes() ([]byte, error) { ...@@ -171,15 +171,15 @@ func (c *Controller) RenderBytes() ([]byte, error) {
return icontent, nil return icontent, nil
} else { } else {
if c.TplNames == "" { if c.TplNames == "" {
c.TplNames = strings.ToLower(c.controllerName)+"/"+strings.ToLower(c.actionName)+"." + c.TplExt c.TplNames = strings.ToLower(c.controllerName) + "/" + strings.ToLower(c.actionName) + "." + c.TplExt
} }
if RunMode == "dev" { if RunMode == "dev" {
BuildTemplate(ViewsPath) BuildTemplate(ViewsPath)
} }
ibytes := bytes.NewBufferString("") ibytes := bytes.NewBufferString("")
if _, ok := BeeTemplates[c.TplNames]; !ok { if _, ok := BeeTemplates[c.TplNames]; !ok {
panic("can't find templatefile in the path:"+c.TplNames) panic("can't find templatefile in the path:" + c.TplNames)
return []byte{}, errors.New("can't find templatefile in the path:"+c.TplNames) return []byte{}, errors.New("can't find templatefile in the path:" + c.TplNames)
} }
err := BeeTemplates[c.TplNames].ExecuteTemplate(ibytes, c.TplNames, c.Data) err := BeeTemplates[c.TplNames].ExecuteTemplate(ibytes, c.TplNames, c.Data)
if err != nil { if err != nil {
...@@ -219,7 +219,7 @@ func (c *Controller) UrlFor(endpoint string, values ...string) string { ...@@ -219,7 +219,7 @@ func (c *Controller) UrlFor(endpoint string, values ...string) string {
return "" return ""
} }
if endpoint[0] == '.' { if endpoint[0] == '.' {
return UrlFor(reflect.Indirect(reflect.ValueOf(c.AppController)).Type().Name() + endpoint, values...) return UrlFor(reflect.Indirect(reflect.ValueOf(c.AppController)).Type().Name()+endpoint, values...)
} else { } else {
return UrlFor(endpoint, values...) return UrlFor(endpoint, values...)
} }
...@@ -327,7 +327,7 @@ func (c *Controller) SaveToFile(fromfile, tofile string) error { ...@@ -327,7 +327,7 @@ func (c *Controller) SaveToFile(fromfile, tofile string) error {
return err return err
} }
defer file.Close() defer file.Close()
f, err := os.OpenFile(tofile, os.O_WRONLY | os.O_CREATE | os.O_TRUNC, 0666) f, err := os.OpenFile(tofile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
if err != nil { if err != nil {
return err return err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment