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
3e29078f
Commit
3e29078f
authored
Apr 28, 2017
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add check ineffect and gofmt
parent
f311ae9e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
13 deletions
+24
-13
.travis.yml
.travis.yml
+3
-0
httplib.go
httplib/httplib.go
+2
-2
alils.go
logs/alils/alils.go
+3
-4
orm_test.go
orm/orm_test.go
+3
-1
sess_file.go
session/sess_file.go
+8
-1
templatefunc_test.go
templatefunc_test.go
+5
-5
No files found.
.travis.yml
View file @
3e29078f
...
...
@@ -35,6 +35,7 @@ install:
-
go get github.com/gogo/protobuf/proto
-
go get -u honnef.co/go/tools/cmd/gosimple
-
go get -u github.com/mdempsky/unconvert
-
go get -u github.com/gordonklaus/ineffassign
before_script
:
-
psql --version
-
sh -c "if [ '$ORM_DRIVER' = 'postgres' ]; then psql -c 'create database orm_test;' -U postgres; fi"
...
...
@@ -51,5 +52,7 @@ script:
-
go test -v ./...
-
gosimple -ignore "$(cat .gosimpleignore)" $(go list ./... | grep -v /vendor/)
-
unconvert $(go list ./... | grep -v /vendor/)
-
ineffassign .
-
find . ! \( -path './vendor' -prune \) -type f -name '*.go' -print0 | xargs -0 gofmt -l -s
addons
:
postgresql
:
"
9.4"
httplib/httplib.go
View file @
3e29078f
...
...
@@ -520,9 +520,9 @@ func (b *BeegoHTTPRequest) Bytes() ([]byte, error) {
return
nil
,
err
}
b
.
body
,
err
=
ioutil
.
ReadAll
(
reader
)
}
else
{
b
.
body
,
err
=
ioutil
.
ReadAll
(
resp
.
Body
)
return
b
.
body
,
err
}
b
.
body
,
err
=
ioutil
.
ReadAll
(
resp
.
Body
)
return
b
.
body
,
err
}
...
...
logs/alils/alils.go
View file @
3e29078f
...
...
@@ -2,11 +2,12 @@ package alils
import
(
"encoding/json"
"github.com/astaxie/beego/logs"
"github.com/gogo/protobuf/proto"
"strings"
"sync"
"time"
"github.com/astaxie/beego/logs"
"github.com/gogo/protobuf/proto"
)
const
(
...
...
@@ -124,12 +125,10 @@ func (c *aliLSWriter) WriteMsg(when time.Time, msg string, level int) (err error
// 默认发到空Topic
if
lg
==
nil
{
topic
=
""
content
=
msg
lg
=
c
.
group
[
0
]
}
}
else
{
topic
=
""
content
=
msg
lg
=
c
.
group
[
0
]
}
...
...
orm/orm_test.go
View file @
3e29078f
...
...
@@ -135,7 +135,7 @@ func getCaller(skip int) string {
if
i
:=
strings
.
LastIndex
(
funName
,
"."
);
i
>
-
1
{
funName
=
funName
[
i
+
1
:
]
}
return
fmt
.
Sprintf
(
"%s:%
d:
\n
%s"
,
fn
,
line
,
strings
.
Join
(
codes
,
"
\n
"
))
return
fmt
.
Sprintf
(
"%s:%
s:%d:
\n
%s"
,
fn
,
funName
,
line
,
strings
.
Join
(
codes
,
"
\n
"
))
}
func
throwFail
(
t
*
testing
.
T
,
err
error
,
args
...
interface
{})
{
...
...
@@ -1014,6 +1014,8 @@ func TestAll(t *testing.T) {
var
users3
[]
*
User
qs
=
dORM
.
QueryTable
(
"user"
)
num
,
err
=
qs
.
Filter
(
"user_name"
,
"nothing"
)
.
All
(
&
users3
)
throwFailNow
(
t
,
err
)
throwFailNow
(
t
,
AssertIs
(
num
,
0
))
throwFailNow
(
t
,
AssertIs
(
users3
==
nil
,
false
))
}
...
...
session/sess_file.go
View file @
3e29078f
...
...
@@ -87,9 +87,16 @@ func (fs *FileSessionStore) SessionRelease(w http.ResponseWriter) {
var
f
*
os
.
File
if
err
==
nil
{
f
,
err
=
os
.
OpenFile
(
path
.
Join
(
filepder
.
savePath
,
string
(
fs
.
sid
[
0
]),
string
(
fs
.
sid
[
1
]),
fs
.
sid
),
os
.
O_RDWR
,
0777
)
if
err
!=
nil
{
SLogger
.
Println
(
err
)
return
}
}
else
if
os
.
IsNotExist
(
err
)
{
f
,
err
=
os
.
Create
(
path
.
Join
(
filepder
.
savePath
,
string
(
fs
.
sid
[
0
]),
string
(
fs
.
sid
[
1
]),
fs
.
sid
))
if
err
!=
nil
{
SLogger
.
Println
(
err
)
return
}
}
else
{
return
}
...
...
templatefunc_test.go
View file @
3e29078f
...
...
@@ -269,28 +269,28 @@ func TestParseFormTag(t *testing.T) {
t
.
Errorf
(
"Form Tag containing only label was not correctly parsed."
)
}
label
,
name
,
fType
,
id
,
class
,
ignored
,
required
=
parseFormTag
(
objT
.
Field
(
3
))
label
,
name
,
fType
,
id
,
class
,
ignored
,
_
=
parseFormTag
(
objT
.
Field
(
3
))
if
!
(
name
==
"name"
&&
label
==
"OnlyName: "
&&
fType
==
"text"
&&
!
ignored
&&
id
==
"name"
&&
class
==
"form-name"
)
{
t
.
Errorf
(
"Form Tag containing only name was not correctly parsed."
)
}
label
,
name
,
fType
,
id
,
class
,
ignored
,
required
=
parseFormTag
(
objT
.
Field
(
4
))
_
,
_
,
_
,
_
,
_
,
ignored
,
_
=
parseFormTag
(
objT
.
Field
(
4
))
if
!
ignored
{
t
.
Errorf
(
"Form Tag that should be ignored was not correctly parsed."
)
}
label
,
name
,
fType
,
id
,
class
,
ignored
,
required
=
parseFormTag
(
objT
.
Field
(
5
))
_
,
name
,
_
,
_
,
_
,
_
,
required
=
parseFormTag
(
objT
.
Field
(
5
))
if
!
(
name
==
"name"
&&
required
)
{
t
.
Errorf
(
"Form Tag containing only name and required was not correctly parsed."
)
}
label
,
name
,
fType
,
id
,
class
,
ignored
,
required
=
parseFormTag
(
objT
.
Field
(
6
))
_
,
name
,
_
,
_
,
_
,
_
,
required
=
parseFormTag
(
objT
.
Field
(
6
))
if
!
(
name
==
"name"
&&
!
required
)
{
t
.
Errorf
(
"Form Tag containing only name and ignore required was not correctly parsed."
)
}
label
,
name
,
fType
,
id
,
class
,
ignored
,
required
=
parseFormTag
(
objT
.
Field
(
7
))
_
,
name
,
_
,
_
,
_
,
_
,
required
=
parseFormTag
(
objT
.
Field
(
7
))
if
!
(
name
==
"name"
&&
!
required
)
{
t
.
Errorf
(
"Form Tag containing only name and not required was not correctly parsed."
)
}
...
...
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