diff --git a/ch5/ch5-10.md b/ch5/ch5-10.md index 18b62f0..fd49767 100644 --- a/ch5/ch5-10.md +++ b/ch5/ch5-10.md @@ -47,17 +47,18 @@ func soleTitle(doc *html.Node) (title string, err error) { }() // Bail out of recursion if we find more than one nonempty title. forEachNode(doc, func(n *html.Node) { - if n.Type == html.ElementNode && n.Data == "title" && n.FirstChild != nil { - if title != "" { - panic(bailout{}) // multiple titleelements + if n.Type == html.ElementNode && n.Data == "title" && + n.FirstChild != nil { + if title != "" { + panic(bailout{}) // multiple titleelements + } + title = n.FirstChild.Data } - title = n.FirstChild.Data - } }, nil) if title == "" { return "", fmt.Errorf("no title element") } - return title, nil + return title, nil } ```