title: How to extract only text from HTML in Golang?
body: <p>To extract text from HTML, I use a fully <a href="https://godoc.org/golang.org/x/net/html" rel="nofollow noreferrer">HTML5-compliant tokenizer and parser</a>, like this </p>
  
  <pre><code>    s := `
  &lt;p&gt;Links:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="foo"&gt;Foo&lt;/a&gt;&lt;li&gt;
  &lt;a href="/bar/baz"&gt;BarBaz&lt;/a&gt;&lt;/ul&gt;&lt;span&gt;TEXT &lt;b&gt;I&lt;/b&gt; WANT&lt;/span&gt;
  &lt;script type='text/javascript'&gt;
  /* &lt;![CDATA[ */
  var post_notif_widget_ajax_obj = {"ajax_url":"http:\/\/site.com\/wp-admin\/admin-ajax.php","nonce":"9b8270e2ef","processing_msg":"Processing..."};
  /* ]]&gt; */
  &lt;/script&gt;`
  
      domDocTest := html.NewTokenizer(strings.NewReader(s))
      for tokenType := domDocTest.Next(); tokenType != html.ErrorToken; {
          if tokenType != html.TextToken {
              tokenType = domDocTest.Next()
              continue
          }
          TxtContent := strings.TrimSpace(html.UnescapeString(string(domDocTest.Text())))
          if len(TxtContent) &gt; 0 {
              fmt.Printf("%s\n", TxtContent)
          }
          tokenType = domDocTest.Next()
      }
  </code></pre>
  
  <p>but I got this result</p>
  
  <pre><code>Links:
  Foo
  BarBaz
  TEXT
  I
  WANT
  /* &lt;![CDATA[ */
  var post_notif_widget_ajax_obj = {"ajax_url":"http:\/\/site.com\/wp-admin\/admin-ajax.php","nonce":"9b8270e2ef","processing_msg":"Processing..."};
  /* ]]&gt; */
  </code></pre>
  
  <p>I don't want <code>CDATA</code> content. Some idea, how to get only the text content?</p>