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
a6ced644
authored
2014-07-17 16:22:41 +0800
by
fuxiaohei
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
code style simplify
1 parent
84da1c92
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
config/xml/xml.go
config/xml/xml_test.go
config/xml/xml.go
View file @
a6ced64
...
...
@@ -7,7 +7,7 @@
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
package
config
package
xml
import
(
"errors"
...
...
@@ -24,27 +24,27 @@ import (
// XmlConfig is a xml config parser and implements Config interface.
// xml configurations should be included in <config></config> tag.
// only support key/value pair as <key>value</key> as each item.
type
XMLConfig
struct
{
}
type
XMLConfig
struct
{}
// Parse returns a ConfigContainer with parsed xml config map.
func
(
x
mls
*
XMLConfig
)
Parse
(
filename
string
)
(
config
.
ConfigContainer
,
error
)
{
func
(
x
c
*
XMLConfig
)
Parse
(
filename
string
)
(
config
.
ConfigContainer
,
error
)
{
file
,
err
:=
os
.
Open
(
filename
)
if
err
!=
nil
{
return
nil
,
err
}
defer
file
.
Close
()
x
:=
&
XMLConfigContainer
{
data
:
make
(
map
[
string
]
interface
{}),
}
x
:=
&
XMLConfigContainer
{
data
:
make
(
map
[
string
]
interface
{})}
content
,
err
:=
ioutil
.
ReadAll
(
file
)
if
err
!=
nil
{
return
nil
,
err
}
d
,
err
:=
x2j
.
DocToMap
(
string
(
content
))
if
err
!=
nil
{
return
nil
,
err
}
x
.
data
=
d
[
"config"
]
.
(
map
[
string
]
interface
{})
return
x
,
nil
}
...
...
config/xml/xml_test.go
View file @
a6ced64
...
...
@@ -7,7 +7,7 @@
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
package
config
package
xml
import
(
"os"
...
...
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