Created
July 25, 2015 12:31
-
-
Save pagoenka/695e8d850c26aa7bb763 to your computer and use it in GitHub Desktop.
Append to file in Go lang
This file contains hidden or 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 ( | |
"bufio" | |
"fmt" | |
"os" | |
) | |
func main() { | |
fileHandle, _ := os.OpenFile("output.txt", os.O_APPEND, 0666) | |
writer := bufio.NewWriter(fileHandle) | |
defer fileHandle.Close() | |
fmt.Fprintln(writer, "String I want to append") | |
writer.Flush() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment