Can anyone tell my why this wouldn\'t compile?
package main
type myint int
func set(a **myint) {
i := myint(5)
*a = &i
}
func main() {
var k *
Here are two functionally equivalent working versions of your program.
package main
type mypint *int
func set(a *mypint) {
i := int(5)
*a = &i
}
func main() {
var k *int
set((*mypint)(&k))
print(*k)
}
http://play.golang.org/p/l_b9LBElie
package main
type myint int
func set(a *myint) *myint {
i := myint(5)
a = &i
return a
}
func main() {
var k *int
k = (*int)(set((*myint)(k)))
print(*k)
}
http://play.golang.org/p/hyaPFUNlp8