Skip to content

Commit

Permalink
[chore] Replace calls to deprecated method: reflect.PtrTo (#418)
Browse files Browse the repository at this point in the history
This replaces all calls to the deprecated method reflect.PtrTo
with the superceding method: reflect.PointerTo.

See https://pkg.go.dev/reflect#PtrTo.
  • Loading branch information
sywhang authored Sep 2, 2024
1 parent ed2ba32 commit e6a848a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ var _ digError = errMissingTypes(nil)
func newErrMissingTypes(c containerStore, k key) errMissingTypes {
// Possible types we will look for in the container. We will always look
// for pointers to the requested type and some extras on a per-Kind basis.
suggestions := []reflect.Type{reflect.PtrTo(k.t)}
suggestions := []reflect.Type{reflect.PointerTo(k.t)}

if k.t.Kind() == reflect.Ptr {
// The user requested a pointer but maybe we have a value.
Expand All @@ -415,7 +415,7 @@ func newErrMissingTypes(c containerStore, k key) errMissingTypes {

if k.t.Kind() == reflect.Slice {
// Maybe the user meant a slice of pointers while we have the slice of elements
suggestions = append(suggestions, reflect.SliceOf(reflect.PtrTo(k.t.Elem())))
suggestions = append(suggestions, reflect.SliceOf(reflect.PointerTo(k.t.Elem())))

// Maybe the user meant a slice of elements while we have the slice of pointers
sliceElement := k.t.Elem()
Expand All @@ -426,7 +426,7 @@ func newErrMissingTypes(c containerStore, k key) errMissingTypes {

if k.t.Kind() == reflect.Array {
// Maybe the user meant an array of pointers while we have the array of elements
suggestions = append(suggestions, reflect.ArrayOf(k.t.Len(), reflect.PtrTo(k.t.Elem())))
suggestions = append(suggestions, reflect.ArrayOf(k.t.Len(), reflect.PointerTo(k.t.Elem())))

// Maybe the user meant an array of elements while we have the array of pointers
arrayElement := k.t.Elem()
Expand Down

0 comments on commit e6a848a

Please sign in to comment.