mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-28 22:21:46 -05:00
hugolib: Defer the unlock in orderedMap.Add
Just in case someone tries to recover from the potential panic.
This commit is contained in:
parent
474bad34ca
commit
24c662ce6b
1 changed files with 1 additions and 2 deletions
|
@ -38,14 +38,13 @@ func newOrderedMapFromStringMapString(m map[string]string) *orderedMap {
|
|||
|
||||
func (m *orderedMap) Add(k, v interface{}) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
_, found := m.m[k]
|
||||
if found {
|
||||
panic(fmt.Sprintf("%v already added", v))
|
||||
}
|
||||
m.m[k] = v
|
||||
m.keys = append(m.keys, k)
|
||||
m.Unlock()
|
||||
|
||||
}
|
||||
|
||||
func (m *orderedMap) Get(k interface{}) (interface{}, bool) {
|
||||
|
|
Loading…
Reference in a new issue