From tutorial in tour of go -
package main
import "fmt"
type Vertex struct {
X int
Y int
}
func main() {
v := Vertex{1, 2}
p := &v
p.X = 1e9
fmt.Println(v)
}
I can just do v.X to get the same value instead of assigning a pointer (p = &v and then p.X). Is there a design pattern that'd be coming up later for the same?
Aucun commentaire:
Enregistrer un commentaire