Created
February 10, 2019 00:03
-
-
Save soypat/e2119c966eabc3de8bc31d015f5279ab to your computer and use it in GitHub Desktop.
Convenient little function for writer handling.
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
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