mirror of https://bitbucket.org/ausocean/av.git
stream/mts/meta/meta.go: using defer for m.mu.Unlock() Meta.Add()
This commit is contained in:
parent
6b32064a2b
commit
cf73c853b0
|
@ -79,15 +79,15 @@ func New() *Metadata {
|
|||
// Add adds metadata with key and val.
|
||||
func (m *Metadata) Add(key, val string) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
m.data[key] = val
|
||||
for _, k := range m.order {
|
||||
if k == key {
|
||||
m.mu.Unlock()
|
||||
return
|
||||
}
|
||||
}
|
||||
m.order = append(m.order, key)
|
||||
m.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// All returns the a copy of the map containing the meta data.
|
||||
|
|
Loading…
Reference in New Issue