diff --git a/report/id_list.go b/report/id_list.go index b285d5dbf..d75df56c3 100644 --- a/report/id_list.go +++ b/report/id_list.go @@ -7,11 +7,17 @@ var emptyIDList = IDList(MakeStringSet()) // MakeIDList makes a new IDList. func MakeIDList(ids ...string) IDList { + if len(ids) == 0 { + return emptyIDList + } return IDList(MakeStringSet(ids...)) } // Add is the only correct way to add ids to an IDList. func (a IDList) Add(ids ...string) IDList { + if len(ids) == 0 { + return a + } return IDList(StringSet(a).Add(ids...)) } diff --git a/report/node_set.go b/report/node_set.go index 1baf2152c..3c4ba7141 100644 --- a/report/node_set.go +++ b/report/node_set.go @@ -27,6 +27,9 @@ func MakeNodeSet(nodes ...Node) NodeSet { // Add adds the nodes to the NodeSet. Add is the only valid way to grow a // NodeSet. Add returns the NodeSet to enable chaining. func (n NodeSet) Add(nodes ...Node) NodeSet { + if len(nodes) == 0 { + return n + } result := n.psMap if result == nil { result = ps.NewMap()