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
10d2c7c3
Commit
10d2c7c3
authored
May 15, 2014
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: fix the import issue
parent
af7ac98b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
6 deletions
+12
-6
xml.go
config/xml/xml.go
+3
-2
xml_test.go
config/xml/xml_test.go
+3
-1
yaml.go
config/yaml/yaml.go
+3
-2
yaml_test.go
config/yaml/yaml_test.go
+3
-1
No files found.
config/xml/xml.go
View file @
10d2c7c3
...
...
@@ -14,6 +14,7 @@ import (
"strings"
"sync"
"github.com/astaxie/beego/config"
"github.com/beego/x2j"
)
...
...
@@ -24,7 +25,7 @@ type XMLConfig struct {
}
// Parse returns a ConfigContainer with parsed xml config map.
func
(
xmls
*
XMLConfig
)
Parse
(
filename
string
)
(
ConfigContainer
,
error
)
{
func
(
xmls
*
XMLConfig
)
Parse
(
filename
string
)
(
config
.
ConfigContainer
,
error
)
{
file
,
err
:=
os
.
Open
(
filename
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -101,5 +102,5 @@ func (c *XMLConfigContainer) DIY(key string) (v interface{}, err error) {
}
func
init
()
{
Register
(
"xml"
,
&
XMLConfig
{})
config
.
Register
(
"xml"
,
&
XMLConfig
{})
}
config/xml/xml_test.go
View file @
10d2c7c3
...
...
@@ -9,6 +9,8 @@ package config
import
(
"os"
"testing"
"github.com/astaxie/beego/config"
)
//xml parse should incluce in <config></config> tags
...
...
@@ -36,7 +38,7 @@ func TestXML(t *testing.T) {
}
f
.
Close
()
defer
os
.
Remove
(
"testxml.conf"
)
xmlconf
,
err
:=
NewConfig
(
"xml"
,
"testxml.conf"
)
xmlconf
,
err
:=
config
.
NewConfig
(
"xml"
,
"testxml.conf"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
config/yaml/yaml.go
View file @
10d2c7c3
...
...
@@ -16,6 +16,7 @@ import (
"strings"
"sync"
"github.com/astaxie/beego/config"
"github.com/beego/goyaml2"
)
...
...
@@ -24,7 +25,7 @@ type YAMLConfig struct {
}
// Parse returns a ConfigContainer with parsed yaml config map.
func
(
yaml
*
YAMLConfig
)
Parse
(
filename
string
)
(
ConfigContainer
,
error
)
{
func
(
yaml
*
YAMLConfig
)
Parse
(
filename
string
)
(
config
.
ConfigContainer
,
error
)
{
y
:=
&
YAMLConfigContainer
{
data
:
make
(
map
[
string
]
interface
{}),
}
...
...
@@ -146,5 +147,5 @@ func (c *YAMLConfigContainer) DIY(key string) (v interface{}, err error) {
}
func
init
()
{
Register
(
"yaml"
,
&
YAMLConfig
{})
config
.
Register
(
"yaml"
,
&
YAMLConfig
{})
}
config/yaml/yaml_test.go
View file @
10d2c7c3
...
...
@@ -9,6 +9,8 @@ package config
import
(
"os"
"testing"
"github.com/astaxie/beego/config"
)
var
yamlcontext
=
`
...
...
@@ -33,7 +35,7 @@ func TestYaml(t *testing.T) {
}
f
.
Close
()
defer
os
.
Remove
(
"testyaml.conf"
)
yamlconf
,
err
:=
NewConfig
(
"yaml"
,
"testyaml.conf"
)
yamlconf
,
err
:=
config
.
NewConfig
(
"yaml"
,
"testyaml.conf"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
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