github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2014/playground/file.go (about) 1 // +build OMIT 2 3 package main 4 5 import ( 6 "fmt" 7 "io/ioutil" 8 "log" 9 ) 10 11 func main() { 12 const filename = "/tmp/file.txt" 13 14 err := ioutil.WriteFile(filename, []byte("Hello, file system\n"), 0644) 15 if err != nil { 16 log.Fatal(err) 17 } 18 19 b, err := ioutil.ReadFile(filename) 20 if err != nil { 21 log.Fatal(err) 22 } 23 24 fmt.Printf("%s", b) 25 }