1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 02:10:54 +00:00

fix golint comments

This commit is contained in:
BorisBorshevsky 2017-11-25 19:16:37 +02:00
parent a5dd5d161d
commit df37739c7d
8 changed files with 17 additions and 13 deletions

1
app.go
View File

@ -55,6 +55,7 @@ func NewApp() *App {
return app
}
// MiddleWare function for http.Handler
type MiddleWare func(http.Handler) http.Handler
// Run beego application.

View File

@ -67,6 +67,7 @@ func Run(params ...string) {
BeeApp.Run()
}
// RunWithMiddleWares Run beego application with middlewares.
func RunWithMiddleWares(addr string, mws ...MiddleWare) {
initBeforeHTTPRun()

View File

@ -131,7 +131,8 @@ func (srv *Server) ListenAndServeTLS(certFile, keyFile string) (err error) {
return srv.Serve()
}
//ListenAndServeMutualTLS
// ListenAndServeMutualTLS listens on the TCP network address srv.Addr and then calls
// Serve to handle requests on incoming mutual TLS connections.
func (srv *Server) ListenAndServeMutualTLS(certFile, keyFile, trustFile string) (err error) {
addr := srv.Addr
if addr == "" {

View File

@ -27,6 +27,7 @@ const (
jsonFormat = "JSON_FORMAT"
)
// AccessLogRecord struct for holding access log data.
type AccessLogRecord struct {
RemoteAddr string `json:"remote_addr"`
RequestTime time.Time `json:"request_time"`
@ -37,8 +38,8 @@ type AccessLogRecord struct {
Status int `json:"status"`
BodyBytesSent int64 `json:"body_bytes_sent"`
ElapsedTime time.Duration `json:"elapsed_time"`
HttpReferrer string `json:"http_referrer"`
HttpUserAgent string `json:"http_user_agent"`
HTTPReferrer string `json:"http_referrer"`
HTTPUserAgent string `json:"http_user_agent"`
RemoteUser string `json:"remote_user"`
}
@ -60,6 +61,7 @@ func disableEscapeHTML(i interface{}) {
}
}
// AccessLog - Format and print access log.
func AccessLog(r *AccessLogRecord, format string) {
var msg string
@ -68,7 +70,7 @@ func AccessLog(r *AccessLogRecord, format string) {
case apacheFormat:
timeFormatted := r.RequestTime.Format("02/Jan/2006 03:04:05")
msg = fmt.Sprintf(apacheFormatPattern, r.RemoteAddr, timeFormatted, r.Request, r.Status, r.BodyBytesSent,
r.ElapsedTime.Seconds(), r.HttpReferrer, r.HttpUserAgent)
r.ElapsedTime.Seconds(), r.HTTPReferrer, r.HTTPUserAgent)
case jsonFormat:
fallthrough
default:

View File

@ -915,8 +915,8 @@ Admin:
Host: r.Host,
Status: statusCode,
ElapsedTime: timeDur,
HttpReferrer: r.Header.Get("Referer"),
HttpUserAgent: r.Header.Get("User-Agent"),
HTTPReferrer: r.Header.Get("Referer"),
HTTPUserAgent: r.Header.Get("User-Agent"),
RemoteUser: r.Header.Get("Remote-User"),
BodyBytesSent: 0, //@todo this one is missing!
}

View File

@ -219,9 +219,8 @@ func BuildTemplate(dir string, files ...string) error {
if err != nil {
logs.Error("parse template err:", file, err)
return err
} else {
beeTemplates[file] = t
}
beeTemplates[file] = t
templatesLock.Unlock()
}
}

View File

@ -72,7 +72,7 @@ func (tc *TestPostUnregController) GetFixedLevel2() {
// should remain intact, and continue to serve the original content.
func TestUnregisterFixedRouteRoot(t *testing.T) {
var method string = "GET"
var method = "GET"
handler := NewControllerRegister()
handler.Add("/", &TestPreUnregController{}, "get:GetFixedRoot")
@ -114,7 +114,7 @@ func TestUnregisterFixedRouteRoot(t *testing.T) {
// should remain intact, and continue to serve the original content.
func TestUnregisterFixedRouteLevel1(t *testing.T) {
var method string = "GET"
var method = "GET"
handler := NewControllerRegister()
handler.Add("/", &TestPreUnregController{}, "get:GetFixedRoot")
@ -164,7 +164,7 @@ func TestUnregisterFixedRouteLevel1(t *testing.T) {
// should remain intact, and continue to serve the original content.
func TestUnregisterFixedRouteLevel2(t *testing.T) {
var method string = "GET"
var method = "GET"
handler := NewControllerRegister()
handler.Add("/", &TestPreUnregController{}, "get:GetFixedRoot")

View File

@ -278,7 +278,7 @@ func (v *Validation) apply(chk Validator, obj interface{}) *Result {
}
}
// Add independent error message for key
// AddError adds independent error message for the provided key
func (v *Validation) AddError(key, message string) {
Name := key
Field := ""