Last active
August 29, 2015 14:16
-
-
Save pressure679/a98abac3359ac604d48d to your computer and use it in GitHub Desktop.
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
func writefile(filename, txt string) { | |
f, err := os.OpenFile(filename, os.O_APPEND, 0644) | |
checkerr(err) | |
_, err = f.WriteString("\n" + "go" + txt) | |
checkerr(err) | |
f.Close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure exactly what you wanted since you left IRC so quick, but my impression was that you wanted to append to one file and write to another new file.
You could accomplish this by using a io.MultiWriter http://golang.org/pkg/io/#MultiWriter
Just give it two or more different writers and it will duplicate whatever you write to it to all writers.