mirror of
https://github.com/tursom/GoCollections.git
synced 2025-03-20 06:10:08 +08:00
15 lines
220 B
Go
15 lines
220 B
Go
package unsafe
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
"unsafe"
|
|
)
|
|
|
|
func TestAsBytes1(t *testing.T) {
|
|
i := 1
|
|
var a any = i
|
|
bs := AsBytes2(i)
|
|
fmt.Println(i, bs, AsBytes1(&a), *(*int)(ForceCast[iface](unsafe.Pointer(&a)).data))
|
|
}
|