Go是否支持内置类型(例如map和slice)的运算符重载?

In python, I can define types that override list item access and dict value access by defining __getitem__(). Can I do something similar in Go?

// What I mean is:
type MySlice []MyItem
// Definition of MySlice
......
func (s MySlice) getItem(i int) MyItem {
}
......
// Access is overrided with calling getItem()
item := ms[0] //calling ms.getItem(0)
// Is this doable?

No, operator overloading is not a feature of Go.

Quoting from the official FAQ to explain why:

Method dispatch is simplified if it doesn't need to do type matching as well. Experience with other languages told us that having a variety of methods with the same name but different signatures was occasionally useful but that it could also be confusing and fragile in practice. Matching only by name and requiring consistency in the types was a major simplifying decision in Go's type system.

Regarding operator overloading, it seems more a convenience than an absolute requirement. Again, things are simpler without it.

You could do something like that using map type. Here is the example.

type MyItem struct {
    name string
}

type MySlice map[int]MyItem

func (m MySlice) getItem(i int) MyItem {
    return m[i]
}

func (m MySlice) setItem(i int, item MyItem) {
    m[i] = item
}

func main() {
    var items = MySlice{}
    items.setItem(0, MyItem{"john"})
    items[1] = MyItem{"doe"}

    var item0 = items[0]
    fmt.Println(item0.name)

    var item1 = items.getItem(1)
    fmt.Println(item1.name)
}

As we could see, the way to set & get item0 and item1 is different but the result is same.

// set data
items.setItem(0, item)
items[0] = item

// get data
item = items[0]
item = items.getItem(0)