Created
March 4, 2014 00:09
-
-
Save vaskoz/9337472 to your computer and use it in GitHub Desktop.
Simple Gokogiri example file that reads and writes the file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
g "github.com/moovweb/gokogiri" | |
. "io/ioutil" | |
_ "fmt" | |
"os" | |
) | |
func main() { | |
file, err := ReadFile("/Users/vaskozdravevski/tmp/data.html") | |
if err != nil { | |
panic("Can't load the file") | |
} | |
htmlDoc, err := g.ParseHtml(file) | |
if err != nil { | |
panic("Can't parse HTML") | |
} | |
WriteFile("/Users/vaskozdravevski/tmp/output.html", | |
[]byte(htmlDoc.String()), os.FileMode(0666)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment