I just tried your generic package and all was good until I ran "go vet". I'm using Go 1.18.10 and wanted to use the generic version of go-clone. "go mod tidy" picks up v1.6.0, and then "go vet" produces:
$ go vet ./...
# github.com/huandu/go-clone/generic
../vendor/github.com/huandu/go-clone/generic/register.go:16:38: undefined: atomic.Pointer
../vendor/github.com/huandu/go-clone/generic/register.go:22:47: undefined: atomic.Pointer
../vendor/github.com/huandu/go-clone/generic/register.go:23:47: undefined: atomic.Pointer
This is (likely) because atomic.Pointer is a Go 1.19 feature. So... I don't think the generic version works in Go 1.18.
I just tried your generic package and all was good until I ran "go vet". I'm using Go 1.18.10 and wanted to use the generic version of go-clone. "go mod tidy" picks up v1.6.0, and then "go vet" produces:
This is (likely) because
atomic.Pointer
is a Go 1.19 feature. So... I don't think the generic version works in Go 1.18.