mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2025-08-07 15:52:24 +00:00
ch5-10: fmt code
This commit is contained in:
@@ -47,7 +47,8 @@ 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 n.Type == html.ElementNode && n.Data == "title" &&
|
||||
n.FirstChild != nil {
|
||||
if title != "" {
|
||||
panic(bailout{}) // multiple titleelements
|
||||
}
|
||||
|
Reference in New Issue
Block a user