gitlab.com/Raven-IO/raven-delve@v1.22.4/_fixtures/testvariables_generic.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"runtime"
     6  )
     7  
     8  type astruct struct {
     9  	x, y int
    10  }
    11  
    12  func testfn[T any, K comparable](arg1 T, arg2 K) {
    13  	m := make(map[K]T)
    14  	m[arg2] = arg1
    15  	runtime.Breakpoint()
    16  	fmt.Println(arg1, arg2, m)
    17  }
    18  
    19  func main() {
    20  	testfn[int, float32](3, 2.1)
    21  	testfn(&astruct{0, 1}, astruct{2, 3})
    22  }