From 0430f3e693ae5ea84c54fb30ef19ce0c8ff77bfc Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Wed, 25 Nov 2020 13:47:53 +1030 Subject: [PATCH] graph: make state of empty less contradictory and provide debugging strings --- graph/nodes_edges.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/graph/nodes_edges.go b/graph/nodes_edges.go index 35b420b2..57551d7b 100644 --- a/graph/nodes_edges.go +++ b/graph/nodes_edges.go @@ -286,9 +286,9 @@ var ( _ WeightedLineSlicer = Empty ) -const nothing = empty(true) +const nothing = empty(0) -type empty bool +type empty int func (empty) Next() bool { return false } func (empty) Len() int { return 0 } @@ -303,3 +303,6 @@ func (empty) Line() Line { return nil } func (empty) LineSlice() []Line { return nil } func (empty) WeightedLine() WeightedLine { return nil } func (empty) WeightedLineSlice() []WeightedLine { return nil } + +func (empty) String() string { return "" } +func (empty) GoString() string { return "graph.Empty" }