golang type parameter
package main
import "fmt"
type Container[T any] struct {
Value T
}
func main() {
// Create a Container of type int
intContainer := Container[int]{Value: 42}
fmt.Println(intContainer.Value) // Output: 42
// Create a Container of type string
stringContainer := Container[string]{Value: "Hello, Go!"}
fmt.Println(stringContainer.Value) // Output: Hello, Go!
}