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
03de7456
Unverified
Commit
03de7456
authored
Jul 21, 2018
by
astaxie
Committed by
GitHub
Jul 21, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3250 from 0x0400/develop
acquire lock when access config data
parents
a048ed51
78f2fd8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
yaml.go
config/yaml/yaml.go
+4
-1
No files found.
config/yaml/yaml.go
View file @
03de7456
...
...
@@ -119,7 +119,7 @@ func parseYML(buf []byte) (cnf map[string]interface{}, err error) {
// ConfigContainer A Config represents the yaml configuration.
type
ConfigContainer
struct
{
data
map
[
string
]
interface
{}
sync
.
Mutex
sync
.
RW
Mutex
}
// Bool returns the boolean value for a given key.
...
...
@@ -285,6 +285,9 @@ func (c *ConfigContainer) getData(key string) (interface{}, error) {
if
len
(
key
)
==
0
{
return
nil
,
errors
.
New
(
"key is empty"
)
}
c
.
RLock
()
defer
c
.
RUnlock
()
keys
:=
strings
.
Split
(
key
,
"."
)
tmpData
:=
c
.
data
for
_
,
k
:=
range
keys
{
...
...
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