gofmt commented go files
Showing
3 changed files
with
10 additions
and
10 deletions
| ... | @@ -10,7 +10,7 @@ import ( | ... | @@ -10,7 +10,7 @@ import ( |
| 10 | "github.com/astaxie/beego/context" | 10 | "github.com/astaxie/beego/context" |
| 11 | ) | 11 | ) |
| 12 | 12 | ||
| 13 | // FitlerFunc defines filter function type. | 13 | // FilterFunc defines filter function type. |
| 14 | type FilterFunc func(*context.Context) | 14 | type FilterFunc func(*context.Context) |
| 15 | 15 | ||
| 16 | // App defines beego application with a new PatternServeMux. | 16 | // App defines beego application with a new PatternServeMux. | ... | ... |
| ... | @@ -144,15 +144,15 @@ func (c *Controller) RenderBytes() ([]byte, error) { | ... | @@ -144,15 +144,15 @@ func (c *Controller) RenderBytes() ([]byte, error) { |
| 144 | //if the controller has set layout, then first get the tplname's content set the content to the layout | 144 | //if the controller has set layout, then first get the tplname's content set the content to the layout |
| 145 | if c.Layout != "" { | 145 | if c.Layout != "" { |
| 146 | if c.TplNames == "" { | 146 | if c.TplNames == "" { |
| 147 | c.TplNames = strings.ToLower(c.controllerName)+"/"+strings.ToLower(c.actionName)+"." + c.TplExt | 147 | c.TplNames = strings.ToLower(c.controllerName) + "/" + strings.ToLower(c.actionName) + "." + c.TplExt |
| 148 | } | 148 | } |
| 149 | if RunMode == "dev" { | 149 | if RunMode == "dev" { |
| 150 | BuildTemplate(ViewsPath) | 150 | BuildTemplate(ViewsPath) |
| 151 | } | 151 | } |
| 152 | newbytes := bytes.NewBufferString("") | 152 | newbytes := bytes.NewBufferString("") |
| 153 | if _, ok := BeeTemplates[c.TplNames]; !ok { | 153 | if _, ok := BeeTemplates[c.TplNames]; !ok { |
| 154 | panic("can't find templatefile in the path:"+c.TplNames) | 154 | panic("can't find templatefile in the path:" + c.TplNames) |
| 155 | return []byte{}, errors.New("can't find templatefile in the path:"+c.TplNames) | 155 | return []byte{}, errors.New("can't find templatefile in the path:" + c.TplNames) |
| 156 | } | 156 | } |
| 157 | err := BeeTemplates[c.TplNames].ExecuteTemplate(newbytes, c.TplNames, c.Data) | 157 | err := BeeTemplates[c.TplNames].ExecuteTemplate(newbytes, c.TplNames, c.Data) |
| 158 | if err != nil { | 158 | if err != nil { |
| ... | @@ -171,15 +171,15 @@ func (c *Controller) RenderBytes() ([]byte, error) { | ... | @@ -171,15 +171,15 @@ func (c *Controller) RenderBytes() ([]byte, error) { |
| 171 | return icontent, nil | 171 | return icontent, nil |
| 172 | } else { | 172 | } else { |
| 173 | if c.TplNames == "" { | 173 | if c.TplNames == "" { |
| 174 | c.TplNames = strings.ToLower(c.controllerName)+"/"+strings.ToLower(c.actionName)+"." + c.TplExt | 174 | c.TplNames = strings.ToLower(c.controllerName) + "/" + strings.ToLower(c.actionName) + "." + c.TplExt |
| 175 | } | 175 | } |
| 176 | if RunMode == "dev" { | 176 | if RunMode == "dev" { |
| 177 | BuildTemplate(ViewsPath) | 177 | BuildTemplate(ViewsPath) |
| 178 | } | 178 | } |
| 179 | ibytes := bytes.NewBufferString("") | 179 | ibytes := bytes.NewBufferString("") |
| 180 | if _, ok := BeeTemplates[c.TplNames]; !ok { | 180 | if _, ok := BeeTemplates[c.TplNames]; !ok { |
| 181 | panic("can't find templatefile in the path:"+c.TplNames) | 181 | panic("can't find templatefile in the path:" + c.TplNames) |
| 182 | return []byte{}, errors.New("can't find templatefile in the path:"+c.TplNames) | 182 | return []byte{}, errors.New("can't find templatefile in the path:" + c.TplNames) |
| 183 | } | 183 | } |
| 184 | err := BeeTemplates[c.TplNames].ExecuteTemplate(ibytes, c.TplNames, c.Data) | 184 | err := BeeTemplates[c.TplNames].ExecuteTemplate(ibytes, c.TplNames, c.Data) |
| 185 | if err != nil { | 185 | 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 { |
| 219 | return "" | 219 | return "" |
| 220 | } | 220 | } |
| 221 | if endpoint[0] == '.' { | 221 | if endpoint[0] == '.' { |
| 222 | return UrlFor(reflect.Indirect(reflect.ValueOf(c.AppController)).Type().Name() + endpoint, values...) | 222 | return UrlFor(reflect.Indirect(reflect.ValueOf(c.AppController)).Type().Name()+endpoint, values...) |
| 223 | } else { | 223 | } else { |
| 224 | return UrlFor(endpoint, values...) | 224 | return UrlFor(endpoint, values...) |
| 225 | } | 225 | } |
| ... | @@ -327,7 +327,7 @@ func (c *Controller) SaveToFile(fromfile, tofile string) error { | ... | @@ -327,7 +327,7 @@ func (c *Controller) SaveToFile(fromfile, tofile string) error { |
| 327 | return err | 327 | return err |
| 328 | } | 328 | } |
| 329 | defer file.Close() | 329 | defer file.Close() |
| 330 | f, err := os.OpenFile(tofile, os.O_WRONLY | os.O_CREATE | os.O_TRUNC, 0666) | 330 | f, err := os.OpenFile(tofile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666) |
| 331 | if err != nil { | 331 | if err != nil { |
| 332 | return err | 332 | return err |
| 333 | } | 333 | } | ... | ... |
-
Please register or sign in to post a comment