diff --git a/crawler/crawl.go b/crawler/crawl.go index 2300ff2..d3bd898 100644 --- a/crawler/crawl.go +++ b/crawler/crawl.go @@ -29,7 +29,7 @@ var Visited = struct { // 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. 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" { for _, a := range node.Attr { 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 @@ -80,7 +80,7 @@ func parseNode(node *html.Node, parent, current string, wg *sync.WaitGroup) ([]s } if val != nil { - links = append(links, val) + links = append(links, *val) } for c := node.FirstChild; c != nil; c = c.NextSibling {