I am trying to implement 2 simple structs as follows:
package main
import (
    "fmt"
)
type MyBoxItem struct {
    Name string
}
type MyBox struct {
    Items []MyBoxItem
}
func (box *MyBox) AddItem(item MyBoxItem) []MyBoxItem {
    return append(box.Items, item)
}
func main() {
    item1 := MyBoxItem{Name: "Test Item 1"}
    item2 := MyBoxItem{Name: "Test Item 2"}
    items := []MyBoxItem{}
    box := MyBox{items}
    AddItem(box, item1)  // This is where i am stuck
    fmt.Println(len(box.Items))
}
What am i doing wrong? I simply want to call the addItem method on the box struct and pass an item in
 
     
     
    