metadata: avoid allocations on delete
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
9c55b1d06a
commit
8532ccebba
@ -28,7 +28,13 @@ func (md Metadata) Set(key, val string) {
|
||||
}
|
||||
|
||||
func (md Metadata) Del(key string) {
|
||||
// fast path
|
||||
if _, ok := md[key]; ok {
|
||||
delete(md, key)
|
||||
} else {
|
||||
// slow path
|
||||
delete(md, textproto.CanonicalMIMEHeaderKey(key))
|
||||
}
|
||||
}
|
||||
|
||||
// Copy makes a copy of the metadata
|
||||
|
Loading…
Reference in New Issue
Block a user