use cast_ptr instead of ptr for go 1.0