package main
import (
"fmt"
)
type alias int
type aliases []*alias
func main() {
a1 := alias(1)
t := aliases{&a1}
fmt.Println([]*int([]*alias(t)))
}
The type type aliases []*alias is essentially []*int
I want to be able to type convert aliases back to []*int
You can with unsafe.Pointer, a little bit unsafe so not recommended
PointerToSliceOfPointersToInt := (*([]*int))(unsafe.Pointer(&t))
try it works https://play.golang.org/p/6AWd1W_it3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With