github.com/switchupcb/yaegi@v0.10.2/_test/unsafe7.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"unsafe"
     6  )
     7  
     8  type S struct {
     9  	X int
    10  	Y int
    11  	Z int
    12  }
    13  
    14  func main() {
    15  	x := [2]S{{Z: 5}, {Z: 10}}
    16  
    17  	s := unsafe.Slice(&x[0], 2)
    18  
    19  	fmt.Println(s)
    20  }