AppendVertexlen
type Vertex struct {
    X int
    Y int
}

func main() {
    var v []Vertex
    fmt.Println(len(v))
    appendVertex(&v)
    fmt.Println(len(v))

}

func appendVertex(v *[]Vertex) {

    *v = append(*v, Vertex{1, 1})

    fmt.Println(len(v))
}

Result for this one is

prog.go:22:16: invalid argument v (type *[]Vertex) for len

I also did another version by passing the pointer to the slice, however the size of slice did not changed, should't the slice is a reference type structure ? why does the size did not changed here

type Vertex struct {
    X int
    Y int
}

func main() {
    var v []*Vertex
    fmt.Println(len(v))
    appendVertex(v)
    fmt.Println(len(v))

}

func appendVertex(v []*Vertex) {

    v = append(v, &Vertex{1, 1})

    fmt.Println(len(v))
}
​

Result for second one is

0
1
0