Files
moxa/_test/a20.go
Marc Vertes a99fb98f84 fix: append() was not returning a type (#84)
append() now returns the underlying array type.
Method lookup was skipped for selector expression on arrays.
Pointer expression was incorrectly parsed as a dereference instead of
type expression.
2019-02-06 14:50:37 +01:00

20 lines
183 B
Go

package main
import "fmt"
type IntArray []int
func (h *IntArray) Add(x int) {
*h = append(*h, x)
}
func main() {
a := IntArray{}
a.Add(4)
fmt.Println(a)
}
// Output:
// [4]