huandu / go-clone

Clone any Go data structure deeply and thoroughly.
https://pkg.go.dev/github.com/huandu/go-clone
MIT License
305 stars 28 forks source link

"go vet" fails in Go 1.18 #22

Closed marcoderama closed 11 months ago

marcoderama commented 12 months ago

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.

marcoderama commented 11 months ago

Thanks!