mirror of
https://github.com/golang/go
synced 2024-11-18 13:24:39 -07:00
internal/telemetry: removing the IsEmpty method of TagMap
It is not being used, and implementing it efficiently is infeasible without reducing the efficiency of cases that matter more. Change-Id: Ie53250f0e63ad08a418724c60a74a52edbdfdb29 Reviewed-on: https://go-review.googlesource.com/c/tools/+/226358 Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
4edcf52965
commit
3b4a2bfdc9
@ -19,8 +19,6 @@ type Tag struct {
|
||||
|
||||
// TagMap is the interface to a collection of Tags indexed by key.
|
||||
type TagMap interface {
|
||||
// IsEmpty returns true if the map holds no tags.
|
||||
IsEmpty() bool
|
||||
// Find returns the tag that matches the supplied key.
|
||||
Find(key interface{}) Tag
|
||||
}
|
||||
@ -200,10 +198,6 @@ func (l tagMap) Find(key interface{}) Tag {
|
||||
return Tag{}
|
||||
}
|
||||
|
||||
func (l tagMap) IsEmpty() bool {
|
||||
return len(l.tags) == 0
|
||||
}
|
||||
|
||||
func (c tagMapChain) Find(key interface{}) Tag {
|
||||
for _, src := range c.maps {
|
||||
tag := src.Find(key)
|
||||
@ -214,15 +208,6 @@ func (c tagMapChain) Find(key interface{}) Tag {
|
||||
return Tag{}
|
||||
}
|
||||
|
||||
func (c tagMapChain) IsEmpty() bool {
|
||||
for _, src := range c.maps {
|
||||
if !src.IsEmpty() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func NewTagIterator(tags ...Tag) TagIterator {
|
||||
if len(tags) == 0 {
|
||||
return TagIterator{}
|
||||
|
@ -176,12 +176,10 @@ func TestTagMap(t *testing.T) {
|
||||
tags []event.Tag
|
||||
keys []event.Key
|
||||
expect string
|
||||
isEmpty bool
|
||||
}{{
|
||||
name: "no tags",
|
||||
keys: []event.Key{AKey},
|
||||
expect: `nil`,
|
||||
isEmpty: true,
|
||||
}, {
|
||||
name: "match A",
|
||||
tags: all,
|
||||
@ -220,9 +218,6 @@ func TestTagMap(t *testing.T) {
|
||||
}} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
tagMap := event.NewTagMap(test.tags...)
|
||||
if tagMap.IsEmpty() != test.isEmpty {
|
||||
t.Errorf("IsEmpty gave %v want %v", tagMap.IsEmpty(), test.isEmpty)
|
||||
}
|
||||
got := printTagMap(tagMap, test.keys)
|
||||
if got != test.expect {
|
||||
t.Errorf("got %q want %q", got, test.expect)
|
||||
@ -237,12 +232,10 @@ func TestTagMapMerge(t *testing.T) {
|
||||
tags [][]event.Tag
|
||||
keys []event.Key
|
||||
expect string
|
||||
isEmpty bool
|
||||
}{{
|
||||
name: "no maps",
|
||||
keys: []event.Key{AKey},
|
||||
expect: `nil`,
|
||||
isEmpty: true,
|
||||
}, {
|
||||
name: "one map",
|
||||
tags: [][]event.Tag{all},
|
||||
@ -253,7 +246,6 @@ func TestTagMapMerge(t *testing.T) {
|
||||
tags: [][]event.Tag{{}},
|
||||
keys: []event.Key{AKey},
|
||||
expect: `nil`,
|
||||
isEmpty: true,
|
||||
}, {
|
||||
name: "two maps",
|
||||
tags: [][]event.Tag{{B, C}, {A}},
|
||||
@ -281,9 +273,6 @@ func TestTagMapMerge(t *testing.T) {
|
||||
maps[i] = event.NewTagMap(v...)
|
||||
}
|
||||
tagMap := event.MergeTagMaps(maps...)
|
||||
if tagMap.IsEmpty() != test.isEmpty {
|
||||
t.Errorf("IsEmpty gave %v want %v", tagMap.IsEmpty(), test.isEmpty)
|
||||
}
|
||||
got := printTagMap(tagMap, test.keys)
|
||||
if got != test.expect {
|
||||
t.Errorf("got %q want %q", got, test.expect)
|
||||
|
Loading…
Reference in New Issue
Block a user