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
87650ce8
Commit
87650ce8
authored
Jan 25, 2016
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make golint happy
parent
fdce4af9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
7 deletions
+3
-7
config.go
config/config.go
+1
-3
xml.go
config/xml/xml.go
+1
-2
yaml.go
config/yaml/yaml.go
+1
-2
No files found.
config/config.go
View file @
87650ce8
...
@@ -113,7 +113,6 @@ func NewConfigData(adapterName string, data []byte) (Configer, error) {
...
@@ -113,7 +113,6 @@ func NewConfigData(adapterName string, data []byte) (Configer, error) {
// 0, 0.0, f, F, FALSE, false, False, NO, no, No, N,n, OFF, off, Off.
// 0, 0.0, f, F, FALSE, false, False, NO, no, No, N,n, OFF, off, Off.
// Any other value returns an error.
// Any other value returns an error.
func
ParseBool
(
val
interface
{})
(
value
bool
,
err
error
)
{
func
ParseBool
(
val
interface
{})
(
value
bool
,
err
error
)
{
if
val
!=
nil
{
if
val
!=
nil
{
switch
v
:=
val
.
(
type
)
{
switch
v
:=
val
.
(
type
)
{
case
bool
:
case
bool
:
...
@@ -140,7 +139,6 @@ func ParseBool(val interface{}) (value bool, err error) {
...
@@ -140,7 +139,6 @@ func ParseBool(val interface{}) (value bool, err error) {
}
}
}
}
return
false
,
fmt
.
Errorf
(
"parsing %q: invalid syntax"
,
val
)
return
false
,
fmt
.
Errorf
(
"parsing %q: invalid syntax"
,
val
)
}
else
{
return
false
,
fmt
.
Errorf
(
"parsing <nil>: invalid syntax"
)
}
}
return
false
,
fmt
.
Errorf
(
"parsing <nil>: invalid syntax"
)
}
}
config/xml/xml.go
View file @
87650ce8
...
@@ -94,9 +94,8 @@ type ConfigContainer struct {
...
@@ -94,9 +94,8 @@ type ConfigContainer struct {
func
(
c
*
ConfigContainer
)
Bool
(
key
string
)
(
bool
,
error
)
{
func
(
c
*
ConfigContainer
)
Bool
(
key
string
)
(
bool
,
error
)
{
if
v
,
ok
:=
c
.
data
[
key
];
ok
{
if
v
,
ok
:=
c
.
data
[
key
];
ok
{
return
config
.
ParseBool
(
v
)
return
config
.
ParseBool
(
v
)
}
else
{
return
false
,
fmt
.
Errorf
(
"not exist key: %q"
,
key
)
}
}
return
false
,
fmt
.
Errorf
(
"not exist key: %q"
,
key
)
}
}
// DefaultBool return the bool value if has no error
// DefaultBool return the bool value if has no error
...
...
config/yaml/yaml.go
View file @
87650ce8
...
@@ -123,9 +123,8 @@ type ConfigContainer struct {
...
@@ -123,9 +123,8 @@ type ConfigContainer struct {
func
(
c
*
ConfigContainer
)
Bool
(
key
string
)
(
bool
,
error
)
{
func
(
c
*
ConfigContainer
)
Bool
(
key
string
)
(
bool
,
error
)
{
if
v
,
ok
:=
c
.
data
[
key
];
ok
{
if
v
,
ok
:=
c
.
data
[
key
];
ok
{
return
config
.
ParseBool
(
v
)
return
config
.
ParseBool
(
v
)
}
else
{
return
false
,
fmt
.
Errorf
(
"not exist key: %q"
,
key
)
}
}
return
false
,
fmt
.
Errorf
(
"not exist key: %q"
,
key
)
}
}
// DefaultBool return the bool value if has no error
// DefaultBool return the bool value if has no error
...
...
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