Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
df37739c
Commit
df37739c
authored
Nov 25, 2017
by
BorisBorshevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix golint comments
parent
a5dd5d16
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
13 deletions
+17
-13
app.go
app.go
+1
-0
beego.go
beego.go
+1
-0
server.go
grace/server.go
+2
-1
accesslog.go
logs/accesslog.go
+5
-3
router.go
router.go
+3
-3
template.go
template.go
+1
-2
unregroute_test.go
unregroute_test.go
+3
-3
validation.go
validation/validation.go
+1
-1
No files found.
app.go
View file @
df37739c
...
...
@@ -55,6 +55,7 @@ func NewApp() *App {
return
app
}
// MiddleWare function for http.Handler
type
MiddleWare
func
(
http
.
Handler
)
http
.
Handler
// Run beego application.
...
...
beego.go
View file @
df37739c
...
...
@@ -67,6 +67,7 @@ func Run(params ...string) {
BeeApp
.
Run
()
}
// RunWithMiddleWares Run beego application with middlewares.
func
RunWithMiddleWares
(
addr
string
,
mws
...
MiddleWare
)
{
initBeforeHTTPRun
()
...
...
grace/server.go
View file @
df37739c
...
...
@@ -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
==
""
{
...
...
logs/accesslog.go
View file @
df37739c
...
...
@@ -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"`
H
ttp
Referrer
string
`json:"http_referrer"`
H
ttp
UserAgent
string
`json:"http_user_agent"`
H
TTP
Referrer
string
`json:"http_referrer"`
H
TTP
UserAgent
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
.
H
ttpReferrer
,
r
.
Http
UserAgent
)
r
.
ElapsedTime
.
Seconds
(),
r
.
H
TTPReferrer
,
r
.
HTTP
UserAgent
)
case
jsonFormat
:
fallthrough
default
:
...
...
router.go
View file @
df37739c
...
...
@@ -915,10 +915,10 @@ Admin:
Host
:
r
.
Host
,
Status
:
statusCode
,
ElapsedTime
:
timeDur
,
H
ttp
Referrer
:
r
.
Header
.
Get
(
"Referer"
),
H
ttp
UserAgent
:
r
.
Header
.
Get
(
"User-Agent"
),
H
TTP
Referrer
:
r
.
Header
.
Get
(
"Referer"
),
H
TTP
UserAgent
:
r
.
Header
.
Get
(
"User-Agent"
),
RemoteUser
:
r
.
Header
.
Get
(
"Remote-User"
),
BodyBytesSent
:
0
,
//@todo this one is missing!
BodyBytesSent
:
0
,
//@todo this one is missing!
}
logs
.
AccessLog
(
record
,
BConfig
.
Log
.
AccessLogsFormat
)
}
else
{
...
...
template.go
View file @
df37739c
...
...
@@ -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
()
}
}
...
...
unregroute_test.go
View file @
df37739c
...
...
@@ -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"
)
...
...
validation/validation.go
View file @
df37739c
...
...
@@ -278,7 +278,7 @@ func (v *Validation) apply(chk Validator, obj interface{}) *Result {
}
}
// Add
independent error message for
key
// Add
Error adds independent error message for the provided
key
func
(
v
*
Validation
)
AddError
(
key
,
message
string
)
{
Name
:=
key
Field
:=
""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment