Remove nil
pointer problems from your go program!
If you are running a recent Linux version, you need to run the following command before using nosigsegv
.
sudo sysctl -w vm.mmap_min_addr=0
Now nil
pointers are not going to crash your program anymore.
Add the following line at the top of your go program:
import _ "github.com/thebabush/nosigsegv"
For a complete example, see cmd/nosigsegv/main.go.
Test it yourself:
$ cd ./cmd/nosigsegv
$ go build
$ ./nosigsegv
initialization ok!
testing...
* <nil> = 123
- Only works on Linux
- Does not support pointer values other than
nil
, unless there's already something allocated at that address