mirror of
https://github.com/PuerkitoBio/goquery
synced 2025-10-04 08:26:37 +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")
|
sel := DocW().Find("h2")
|
||||||
b.StartTimer()
|
b.StartTimer()
|
||||||
for i := 0; i < b.N; i++ {
|
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:
|
case html.ElementNode, html.DoctypeNode:
|
||||||
return node.Data
|
return node.Data
|
||||||
default:
|
default:
|
||||||
if node.Type >= 0 && int(node.Type) < len(nodeNames) {
|
if int(node.Type) < len(nodeNames) {
|
||||||
return nodeNames[node.Type]
|
return nodeNames[node.Type]
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render renders the html of the first element from selector and writes it to the writer.
|
// Render renders the html of the first element from selector and writes it to
|
||||||
// // It behaves the same as OuterHtml but writes to w instead of returning the string.
|
// 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 {
|
func Render(w io.Writer, s *Selection) error {
|
||||||
if s.Length() == 0 {
|
if s.Length() == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
@@ -80,6 +80,7 @@ func TestNodeNameMultiSel(t *testing.T) {
|
|||||||
t.Errorf("want %v, got %v", in, out)
|
t.Errorf("want %v, got %v", in, out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOuterHtml(t *testing.T) {
|
func TestOuterHtml(t *testing.T) {
|
||||||
doc, err := NewDocumentFromReader(strings.NewReader(allNodes))
|
doc, err := NewDocumentFromReader(strings.NewReader(allNodes))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user