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>
diff --git a/internal/telemetry/event/tag.go b/internal/telemetry/event/tag.go
index 1fd271a..7d7a34c 100644
--- a/internal/telemetry/event/tag.go
+++ b/internal/telemetry/event/tag.go
@@ -19,8 +19,6 @@
 
 // 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 @@
 	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 @@
 	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{}
diff --git a/internal/telemetry/event/tag_test.go b/internal/telemetry/event/tag_test.go
index 6d7539f..e5d7e47 100644
--- a/internal/telemetry/event/tag_test.go
+++ b/internal/telemetry/event/tag_test.go
@@ -172,16 +172,14 @@
 
 func TestTagMap(t *testing.T) {
 	for _, test := range []struct {
-		name    string
-		tags    []event.Tag
-		keys    []event.Key
-		expect  string
-		isEmpty bool
+		name   string
+		tags   []event.Tag
+		keys   []event.Key
+		expect string
 	}{{
-		name:    "no tags",
-		keys:    []event.Key{AKey},
-		expect:  `nil`,
-		isEmpty: true,
+		name:   "no tags",
+		keys:   []event.Key{AKey},
+		expect: `nil`,
 	}, {
 		name:   "match A",
 		tags:   all,
@@ -220,9 +218,6 @@
 	}} {
 		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)
@@ -233,27 +228,24 @@
 
 func TestTagMapMerge(t *testing.T) {
 	for _, test := range []struct {
-		name    string
-		tags    [][]event.Tag
-		keys    []event.Key
-		expect  string
-		isEmpty bool
+		name   string
+		tags   [][]event.Tag
+		keys   []event.Key
+		expect string
 	}{{
-		name:    "no maps",
-		keys:    []event.Key{AKey},
-		expect:  `nil`,
-		isEmpty: true,
+		name:   "no maps",
+		keys:   []event.Key{AKey},
+		expect: `nil`,
 	}, {
 		name:   "one map",
 		tags:   [][]event.Tag{all},
 		keys:   []event.Key{AKey},
 		expect: `A="a"`,
 	}, {
-		name:    "invalid map",
-		tags:    [][]event.Tag{{}},
-		keys:    []event.Key{AKey},
-		expect:  `nil`,
-		isEmpty: true,
+		name:   "invalid map",
+		tags:   [][]event.Tag{{}},
+		keys:   []event.Key{AKey},
+		expect: `nil`,
 	}, {
 		name:   "two maps",
 		tags:   [][]event.Tag{{B, C}, {A}},
@@ -281,9 +273,6 @@
 				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)