Skip to content

Instantly share code, notes, and snippets.

@pagoenka
Created July 25, 2015 12:31
Show Gist options
  • Save pagoenka/695e8d850c26aa7bb763 to your computer and use it in GitHub Desktop.
Save pagoenka/695e8d850c26aa7bb763 to your computer and use it in GitHub Desktop.
Append to file in Go lang
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