mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 12:20:55 +00:00
Fix formatting with gofmt
This commit is contained in:
parent
2c5ef8ccc8
commit
adbae18e8c
@ -34,14 +34,14 @@ import (
|
|||||||
//commonly used mime-types
|
//commonly used mime-types
|
||||||
const (
|
const (
|
||||||
applicationJSON = "application/json"
|
applicationJSON = "application/json"
|
||||||
applicationXML = "application/xml"
|
applicationXML = "application/xml"
|
||||||
textXML = "text/xml"
|
textXML = "text/xml"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ErrAbort custom error when user stop request handler manually.
|
// ErrAbort custom error when user stop request handler manually.
|
||||||
ErrAbort = errors.New("User stop run")
|
ErrAbort = errors.New("User stop run")
|
||||||
// GlobalControllerRouter store comments with controller. pkgpath+controller:comments
|
// GlobalControllerRouter store comments with controller. pkgpath+controller:comments
|
||||||
GlobalControllerRouter = make(map[string][]ControllerComments)
|
GlobalControllerRouter = make(map[string][]ControllerComments)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -56,31 +56,31 @@ type ControllerComments struct {
|
|||||||
// Controller defines some basic http request handler operations, such as
|
// Controller defines some basic http request handler operations, such as
|
||||||
// http context, template and view, session and xsrf.
|
// http context, template and view, session and xsrf.
|
||||||
type Controller struct {
|
type Controller struct {
|
||||||
// context data
|
// context data
|
||||||
Ctx *context.Context
|
Ctx *context.Context
|
||||||
Data map[interface{}]interface{}
|
Data map[interface{}]interface{}
|
||||||
|
|
||||||
// route controller info
|
// route controller info
|
||||||
controllerName string
|
controllerName string
|
||||||
actionName string
|
actionName string
|
||||||
methodMapping map[string]func() //method:routertree
|
methodMapping map[string]func() //method:routertree
|
||||||
gotofunc string
|
gotofunc string
|
||||||
AppController interface{}
|
AppController interface{}
|
||||||
|
|
||||||
// template data
|
// template data
|
||||||
TplName string
|
TplName string
|
||||||
Layout string
|
Layout string
|
||||||
LayoutSections map[string]string // the key is the section name and the value is the template name
|
LayoutSections map[string]string // the key is the section name and the value is the template name
|
||||||
TplExt string
|
TplExt string
|
||||||
EnableRender bool
|
EnableRender bool
|
||||||
|
|
||||||
// xsrf data
|
// xsrf data
|
||||||
_xsrfToken string
|
_xsrfToken string
|
||||||
XSRFExpire int
|
XSRFExpire int
|
||||||
EnableXSRF bool
|
EnableXSRF bool
|
||||||
|
|
||||||
// session
|
// session
|
||||||
CruSession session.Store
|
CruSession session.Store
|
||||||
}
|
}
|
||||||
|
|
||||||
// ControllerInterface is an interface to uniform all controller handler.
|
// ControllerInterface is an interface to uniform all controller handler.
|
||||||
@ -284,7 +284,7 @@ func (c *Controller) URLFor(endpoint string, values ...interface{}) 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...)
|
||||||
}
|
}
|
||||||
return URLFor(endpoint, values...)
|
return URLFor(endpoint, values...)
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ func (c *Controller) URLFor(endpoint string, values ...interface{}) string {
|
|||||||
// ServeJSON sends a json response with encoding charset.
|
// ServeJSON sends a json response with encoding charset.
|
||||||
func (c *Controller) ServeJSON(encoding ...bool) {
|
func (c *Controller) ServeJSON(encoding ...bool) {
|
||||||
var (
|
var (
|
||||||
hasIndent = true
|
hasIndent = true
|
||||||
hasEncoding = false
|
hasEncoding = false
|
||||||
)
|
)
|
||||||
if BConfig.RunMode == PROD {
|
if BConfig.RunMode == PROD {
|
||||||
@ -490,7 +490,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
|
||||||
}
|
}
|
||||||
@ -588,7 +588,7 @@ func (c *Controller) CheckXSRFCookie() bool {
|
|||||||
// XSRFFormHTML writes an input field contains xsrf token value.
|
// XSRFFormHTML writes an input field contains xsrf token value.
|
||||||
func (c *Controller) XSRFFormHTML() string {
|
func (c *Controller) XSRFFormHTML() string {
|
||||||
return `<input type="hidden" name="_xsrf" value="` +
|
return `<input type="hidden" name="_xsrf" value="` +
|
||||||
c.XSRFToken() + `" />`
|
c.XSRFToken() + `" />`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetControllerAndAction gets the executing controller name and action name.
|
// GetControllerAndAction gets the executing controller name and action name.
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var currentWorkDir, _ = os.Getwd()
|
var currentWorkDir, _ = os.Getwd()
|
||||||
|
Loading…
Reference in New Issue
Block a user