Fix some small linting issues

This commit is contained in:
Martin Angers
2021-10-25 20:16:05 -04:00
parent 4110e175b5
commit b6dc0bd0ea
3 changed files with 6 additions and 4 deletions

View File

@@ -46,6 +46,6 @@ func BenchmarkHtml(b *testing.B) {
sel := DocW().Find("h2")
b.StartTimer()
for i := 0; i < b.N; i++ {
sel.Html()
_, _ = sel.Html()
}
}

View File

@@ -51,15 +51,16 @@ func nodeName(node *html.Node) string {
case html.ElementNode, html.DoctypeNode:
return node.Data
default:
if node.Type >= 0 && int(node.Type) < len(nodeNames) {
if int(node.Type) < len(nodeNames) {
return nodeNames[node.Type]
}
return ""
}
}
// Render renders the html of the first element from selector and writes it to the writer.
// // It behaves the same as OuterHtml but writes to w instead of returning the string.
// Render renders the html of the first element from selector and writes it to
// the writer. It behaves the same as OuterHtml but writes to w instead of
// returning the string.
func Render(w io.Writer, s *Selection) error {
if s.Length() == 0 {
return nil

View File

@@ -80,6 +80,7 @@ func TestNodeNameMultiSel(t *testing.T) {
t.Errorf("want %v, got %v", in, out)
}
}
func TestOuterHtml(t *testing.T) {
doc, err := NewDocumentFromReader(strings.NewReader(allNodes))
if err != nil {