make golint happy

This commit is contained in:
astaxie 2015-09-07 21:38:53 +08:00
parent 919675e793
commit 152127c2af
4 changed files with 20 additions and 19 deletions

View File

@ -314,14 +314,14 @@ func profIndex(rw http.ResponseWriter, r *http.Request) {
data["Content"] = result.String()
if format == "json" && command == "gc summary" {
dataJson, err := json.Marshal(data)
dataJSON, err := json.Marshal(data)
if err != nil {
http.Error(rw, err.Error(), http.StatusInternalServerError)
return
}
rw.Header().Set("Content-Type", "application/json")
rw.Write(dataJson)
rw.Write(dataJSON)
return
}

21
app.go
View File

@ -28,6 +28,7 @@ import (
)
var (
// BeeApp is an application instance
BeeApp *App
)
@ -202,7 +203,7 @@ func Router(rootpath string, c ControllerInterface, mappingMethods ...string) *A
return BeeApp
}
// Router add list from
// Include will generate router file in the router/xxx.go from the controller's comments
// usage:
// beego.Include(&BankAccount{}, &OrderController{},&RefundController{},&ReceiptController{})
// type BankAccount struct{
@ -261,7 +262,7 @@ func AutoPrefix(prefix string, c ControllerInterface) *App {
return BeeApp
}
// register router for Get method
// Get used to register router for Get method
// usage:
// beego.Get("/", func(ctx *context.Context){
// ctx.Output.Body("hello world")
@ -271,7 +272,7 @@ func Get(rootpath string, f FilterFunc) *App {
return BeeApp
}
// register router for Post method
// Post used to register router for Post method
// usage:
// beego.Post("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
@ -281,7 +282,7 @@ func Post(rootpath string, f FilterFunc) *App {
return BeeApp
}
// register router for Delete method
// Delete used to register router for Delete method
// usage:
// beego.Delete("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
@ -291,7 +292,7 @@ func Delete(rootpath string, f FilterFunc) *App {
return BeeApp
}
// register router for Put method
// Put used to register router for Put method
// usage:
// beego.Put("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
@ -301,7 +302,7 @@ func Put(rootpath string, f FilterFunc) *App {
return BeeApp
}
// register router for Head method
// Head used to register router for Head method
// usage:
// beego.Head("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
@ -311,7 +312,7 @@ func Head(rootpath string, f FilterFunc) *App {
return BeeApp
}
// register router for Options method
// Options used to register router for Options method
// usage:
// beego.Options("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
@ -321,7 +322,7 @@ func Options(rootpath string, f FilterFunc) *App {
return BeeApp
}
// register router for Patch method
// Patch used to register router for Patch method
// usage:
// beego.Patch("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
@ -331,7 +332,7 @@ func Patch(rootpath string, f FilterFunc) *App {
return BeeApp
}
// register router for all method
// Any used to register router for all methods
// usage:
// beego.Any("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")
@ -341,7 +342,7 @@ func Any(rootpath string, f FilterFunc) *App {
return BeeApp
}
// register router for own Handler
// Handler used to register a Handler router
// usage:
// beego.Handler("/api", func(ctx *context.Context){
// ctx.Output.Body("hello world")

View File

@ -31,7 +31,8 @@ var (
hooks = make([]hookfunc, 0) //hook function slice to store the hookfunc
)
// The hookfunc will run in beego.Run()
// AddAPPStartHook is used to register the hookfunc
// The hookfuncs will run in beego.Run()
// such as sessionInit, middlerware start, buildtemplate, admin start
func AddAPPStartHook(hf hookfunc) {
hooks = append(hooks, hf)
@ -42,7 +43,7 @@ func AddAPPStartHook(hf hookfunc) {
// beego.Run(":8089")
// beego.Run("127.0.0.1:8089")
func Run(params ...string) {
initBeforeHttpRun()
initBeforeHTTPRun()
if len(params) > 0 && params[0] != "" {
strs := strings.Split(params[0], ":")
@ -57,7 +58,7 @@ func Run(params ...string) {
BeeApp.Run()
}
func initBeforeHttpRun() {
func initBeforeHTTPRun() {
// if AppConfigPath not In the conf/app.conf reParse config
if AppConfigPath != filepath.Join(AppPath, "conf", "app.conf") {
err := ParseConfig()
@ -82,7 +83,7 @@ func initBeforeHttpRun() {
}
}
// this function is for test package init
// TestBeegoInit is for test package init
func TestBeegoInit(apppath string) {
AppPath = apppath
os.Setenv("BEEGO_RUNMODE", "test")
@ -93,5 +94,5 @@ func TestBeegoInit(apppath string) {
Info(err)
}
os.Chdir(AppPath)
initBeforeHttpRun()
initBeforeHTTPRun()
}

View File

@ -71,8 +71,7 @@ func registerSession() error {
`"domain":"` + SessionDomain + `",` +
`"cookieLifeTime":` + strconv.Itoa(SessionCookieLifeTime) + `}`
}
GlobalSessions, err = session.NewManager(SessionProvider,
sessionConfig)
GlobalSessions, err = session.NewManager(SessionProvider, sessionConfig)
if err != nil {
return err
}