crawler: fix syntax issue (where did that come from?)
This commit is contained in:
@@ -29,7 +29,7 @@ var Visited = struct {
|
|||||||
// visited it yet, will spawn a goroutine for it. It will also return that link,
|
// visited it yet, will spawn a goroutine for it. It will also return that link,
|
||||||
// because we have to add it to our list of linked nodes.
|
// because we have to add it to our list of linked nodes.
|
||||||
func visitNode(node *html.Node, parent, current string, wg *sync.WaitGroup) (*string, error) {
|
func visitNode(node *html.Node, parent, current string, wg *sync.WaitGroup) (*string, error) {
|
||||||
var val *string
|
var val string
|
||||||
if node.Type == html.ElementNode && node.Data == "a" {
|
if node.Type == html.ElementNode && node.Data == "a" {
|
||||||
for _, a := range node.Attr {
|
for _, a := range node.Attr {
|
||||||
if a.Key != "href" {
|
if a.Key != "href" {
|
||||||
@@ -65,7 +65,7 @@ func visitNode(node *html.Node, parent, current string, wg *sync.WaitGroup) (*st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return val, nil
|
return &val, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseNode parses a single node. It is recursive, and will first be called
|
// parseNode parses a single node. It is recursive, and will first be called
|
||||||
@@ -80,7 +80,7 @@ func parseNode(node *html.Node, parent, current string, wg *sync.WaitGroup) ([]s
|
|||||||
}
|
}
|
||||||
|
|
||||||
if val != nil {
|
if val != nil {
|
||||||
links = append(links, val)
|
links = append(links, *val)
|
||||||
}
|
}
|
||||||
|
|
||||||
for c := node.FirstChild; c != nil; c = c.NextSibling {
|
for c := node.FirstChild; c != nil; c = c.NextSibling {
|
||||||
|
Reference in New Issue
Block a user