metadata: change method name (#1454)

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-03-31 23:39:18 +03:00 committed by GitHub
parent 5e65a46be3
commit 3a22efbd7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ func (md Metadata) Get(key string) (string, bool) {
return val, ok return val, ok
} }
func (md Metadata) Del(key string) { func (md Metadata) Delete(key string) {
// delete key as-is // delete key as-is
delete(md, key) delete(md, key)
// delete also Title key // delete also Title key
@ -41,8 +41,8 @@ func Copy(md Metadata) Metadata {
return cmd return cmd
} }
// Del key from metadata // Delete key from metadata
func Del(ctx context.Context, k string) context.Context { func Delete(ctx context.Context, k string) context.Context {
return Set(ctx, k, "") return Set(ctx, k, "")
} }

View File

@ -18,14 +18,14 @@ func TestMetadataSet(t *testing.T) {
} }
} }
func TestMetadataDel(t *testing.T) { func TestMetadataDelete(t *testing.T) {
md := Metadata{ md := Metadata{
"Foo": "bar", "Foo": "bar",
"Baz": "empty", "Baz": "empty",
} }
ctx := NewContext(context.TODO(), md) ctx := NewContext(context.TODO(), md)
ctx = Set(ctx, "Baz", "") ctx = Delete(ctx, "Baz")
emd, ok := FromContext(ctx) emd, ok := FromContext(ctx)
if !ok { if !ok {