I don't know if you can validate stuff before sending "invalid" system calls, but the code below cause the Kernel to terminate the program, it could be nice if go could throw panic in these situations, it will be much easier to debug, I had to use strace to figure it out.
version: go version go1.4.1 darwin/amd64 ( installed via the official package for os x )
os: OS X 10.10.1 - Yosemite
The first step in debugging a Go program is to check your errors. Checking the result of strconv.Atoi would have been easier than using strace.
I don't think we can sensibly guard against sending bad arguments to system calls. There are so many system calls, and different kernels regard different inputs as valid and invalid. The programmer should take care when making system calls.
I'm going to close this issue, but someone can re-open it if they feel differently.