Generic Method Parameters in Golang
问题 I need help with making this work for any type. I have got a function I need to accept other types that have ID property. I have tried using interfaces but that did not work for my ID property case. Here is the code: package main import ( "fmt" "strconv" ) type Mammal struct{ ID int Name string } type Human struct { ID int Name string HairColor string } func Count(ms []Mammal) *[]string { // How can i get this function to accept any type not just []Mammal IDs := make([]string, len(ms)) for i,