diff options
author | Andrew Gerrand <adg@golang.org> | 2013-12-13 09:27:07 +1100 |
---|---|---|
committer | Andrew Gerrand <adg@golang.org> | 2013-12-13 09:27:07 +1100 |
commit | c7a7ecad260d219c1b693f8d76238a36ba514d71 (patch) | |
tree | 7c686d10d4297bcbf05676fcdcd8e38a38e18f76 /content/playground/os.go | |
parent | d67810e6e4ff1c7bcde714ff7267f9f0006e06eb (diff) |
go.blog: add "Inside the Go Playground" article
R=r, rsc, dsymonds
https://golang.org/cl/39180043
Diffstat (limited to 'content/playground/os.go')
-rw-r--r-- | content/playground/os.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/content/playground/os.go b/content/playground/os.go new file mode 100644 index 0000000..a73beb0 --- /dev/null +++ b/content/playground/os.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + "io/ioutil" + "log" +) + +func main() { + const filename = "/tmp/file.txt" + + err := ioutil.WriteFile(filename, []byte("Hello, file system\n"), 0644) + if err != nil { + log.Fatal(err) + } + + b, err := ioutil.ReadFile(filename) + if err != nil { + log.Fatal(err) + } + + fmt.Printf("%s", b) +} |