mirror of
https://github.com/PuerkitoBio/goquery
synced 2025-09-26 21:01:21 +08:00
Fix some small linting issues
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user