Skip to content

Instantly share code, notes, and snippets.

@soypat
Created February 10, 2019 00:03
Show Gist options
  • Save soypat/e2119c966eabc3de8bc31d015f5279ab to your computer and use it in GitHub Desktop.
Save soypat/e2119c966eabc3de8bc31d015f5279ab to your computer and use it in GitHub Desktop.
Convenient little function for writer handling.
d, err := os.Create("nodos.txt")
writer := bufio.NewWriter(d)
defer func() {
if err := writer.Flush(); err!=nil {
fmt.Println(err)
enterContinue("Se encontro un error en escritura! Verifique integridad de nodos.txt!")
}
err = d.Sync()
check(err)
err = d.Close()
check(err)
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment