pelletier / go-toml

Go library for the TOML file format
https://github.com/pelletier/go-toml
Other
1.69k stars 206 forks source link

undefined: reflect.Pointer #812

Closed cxy1620541673 closed 2 years ago

cxy1620541673 commented 2 years ago

Describe the bug

github.com/pelletier/go-toml/v2

D:\go\pkg\mod\github.com\pelletier\go-toml\v2@v2.0.4\unmarshaler.go:1143:37: undefined: reflect.Pointer D:\go\pkg\mod\github.com\pelletier\go-toml\v2@v2.0.4\unmarshaler.go:1211:20: undefined: reflect.Pointer

To Reproduce go get -u all

Expected behavior dont report error when do "go get -u "

Versions

Additional context Add any other context about the problem here that you think may help to diagnose.

mohankc commented 2 years ago

Same issue when we create a docker image.

github.com/pelletier/go-toml/v2

32 287.9 ../../../../pkg/mod/github.com/pelletier/go-toml/v2@v2.0.4/unmarshaler.go:1143:37: undefined: reflect.Pointer

32 287.9 ../../../../pkg/mod/github.com/pelletier/go-toml/v2@v2.0.4/unmarshaler.go:1211:20: undefined: reflect.Pointer

moorereason commented 2 years ago

reflect.Ptr was renamed to reflect.Pointer in Go 1.18. Use a newer Go release to work around this issue.

go-toml should use reflect.Ptr if we want to maintain backwards compatibility. From the Go 1.18 release notes:

reflect.Ptr and reflect.PtrTo have been renamed to reflect.Pointer and reflect.PointerTo, respectively, for consistency with the rest of the reflect package. The old names will continue to work, but will be deprecated in a future Go release.

pelletier commented 2 years ago

I'll push a new version with reflect.Ptr given it's a trivial change, but keep in mind that go-toml only supports the last two versions of Go (https://github.com/pelletier/go-toml#versioning):

The last two major versions of Go are supported (see Go Release Policy).

pelletier commented 2 years ago

Release https://github.com/pelletier/go-toml/releases/tag/v2.0.5 with the reflect.Ptr fix.