Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
二次元的罪恶王冠
beego
提交
ef815bf5
B
beego
项目概览
二次元的罪恶王冠
/
beego
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
beego
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ef815bf5
编写于
5月 15, 2014
作者:
A
astaxie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
config: fix the import issue
上级
6082a0af
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
6 deletion
+12
-6
config/xml/xml.go
config/xml/xml.go
+3
-2
config/xml/xml_test.go
config/xml/xml_test.go
+3
-1
config/yaml/yaml.go
config/yaml/yaml.go
+3
-2
config/yaml/yaml_test.go
config/yaml/yaml_test.go
+3
-1
未找到文件。
config/xml/xml.go
浏览文件 @
ef815bf5
...
...
@@ -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
浏览文件 @
ef815bf5
...
...
@@ -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
浏览文件 @
ef815bf5
...
...
@@ -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
浏览文件 @
ef815bf5
...
...
@@ -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
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录