stream/mts/meta/meta.go: using copy instead of append to remove key from order slice in Meta.Delete()

This commit is contained in:
saxon 2019-02-05 23:29:07 +10:30
parent cf73c853b0
commit 89b05b3cb6
1 changed files with 2 additions and 1 deletions

View File

@ -120,7 +120,8 @@ func (m *Metadata) Delete(key string) error {
delete(m.data, key)
for i, k := range m.order {
if k == key {
m.order = append(m.order[:i], m.order[i+1:]...)
copy(m.order[:i], m.order[i+1:])
m.order = m.order[:len(m.order)-1]
break
}
}