Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
20e05a39
authored
2014-07-12 16:03:14 +0800
by
fuxiaohei
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
code style simplify
1 parent
77c40e6f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
config/config.go
config/fake.go
config/config.go
View file @
20e05a3
...
...
@@ -39,7 +39,7 @@ func Register(name string, adapter Config) {
if
adapter
==
nil
{
panic
(
"config: Register adapter is nil"
)
}
if
_
,
dup
:=
adapters
[
name
];
dup
{
if
_
,
ok
:=
adapters
[
name
];
ok
{
panic
(
"config: Register called twice for adapter "
+
name
)
}
adapters
[
name
]
=
adapter
...
...
config/fake.go
View file @
20e05a3
...
...
@@ -20,13 +20,11 @@ type fakeConfigContainer struct {
}
func
(
c
*
fakeConfigContainer
)
getData
(
key
string
)
string
{
key
=
strings
.
ToLower
(
key
)
return
c
.
data
[
key
]
return
c
.
data
[
strings
.
ToLower
(
key
)]
}
func
(
c
*
fakeConfigContainer
)
Set
(
key
,
val
string
)
error
{
key
=
strings
.
ToLower
(
key
)
c
.
data
[
key
]
=
val
c
.
data
[
strings
.
ToLower
(
key
)]
=
val
return
nil
}
...
...
@@ -55,8 +53,7 @@ func (c *fakeConfigContainer) Float(key string) (float64, error) {
}
func
(
c
*
fakeConfigContainer
)
DIY
(
key
string
)
(
interface
{},
error
)
{
key
=
strings
.
ToLower
(
key
)
if
v
,
ok
:=
c
.
data
[
key
];
ok
{
if
v
,
ok
:=
c
.
data
[
strings
.
ToLower
(
key
)];
ok
{
return
v
,
nil
}
return
nil
,
errors
.
New
(
"key not find"
)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment