htmltools

Various command line tools to transform HTML documents
git clone git://git.entf.net/htmltools
Log | Files | Refs | README | LICENSE

commit 41fbbc2f62efa4c78dc3c33fd55cd01e42c67f8e
parent c6f10d13d6fbaf0ca6c8c4a68fc9130d8c09f839
Author: Lukas Henkel <lh@entf.net>
Date:   Fri, 19 Feb 2021 21:03:39 +0100

Close the channel

Diffstat:
Mhtmltools.go | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/htmltools.go b/htmltools.go @@ -62,7 +62,10 @@ func findRecursive(node *html.Node, nodeFunc func(*html.Node) bool, ch chan<- *h // the whole document. If nodeFunc is `nil`, all nodes match. func FindRecursive(doc *html.Node, nodeFunc NodeMatchFunc) <-chan *html.Node { ch := make(chan *html.Node) - go findRecursive(doc, nodeFunc, ch) + go func() { + findRecursive(doc, nodeFunc, ch) + close(ch) + }() return ch }