The easiest and safest way is to copy it to a fragment, and not to [1024]byte
mySlice := C.GoBytes(unsafe.Pointer(&C.my_buff), C.BUFF_SIZE)
To use memory directly without a copy, you can "distinguish" it through unsafe.Pointer .
mySlice := (*[1 << 30]byte)(unsafe.Pointer(&C.my_buf))[:int(C.BUFF_SIZE):int(C.BUFF_SIZE)]
source share