Skip to content

Instantly share code, notes, and snippets.

@yifan-gu
Last active August 29, 2015 14:04
Show Gist options
  • Save yifan-gu/fe088561df58cd830d69 to your computer and use it in GitHub Desktop.
Save yifan-gu/fe088561df58cd830d69 to your computer and use it in GitHub Desktop.
test write full error
$ go build testwritefull.go
$ sudo ./testwritefull
write err write /run/tmpfile: no space left on device
package main
import (
"fmt"
"os"
"io"
)
func main() {
r, err := os.Open("/dev/zero")
f, err := os.Create("/run/tmpfile")
if err != nil {
fmt.Println("err", err)
return
}
for {
if _, err := io.Copy(f, r); err != nil {
fmt.Println("write err", err)
return
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment