Skip to content

Conversation

@HadrienPatte
Copy link
Contributor

Ptr has been deprecated and has a gofix directive to inline it to Pointer.

See Ptr.

Also replace reflect.PtrTo with reflect.PointerTo for the same reason:

PtrTo is the old spelling of PointerTo. The two functions behave identically.

`Ptr` has been deprecated and has a [gofix](https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/gofix#hdr-Constants) directive to inline it to `Pointer`.

See [`Ptr`](https://cs.opensource.google/go/go/+/refs/tags/go1.18:src/reflect/type.go;l=272).

Also replace `reflect.PtrTo` with `reflect.PointerTo` for the same
[reason](https://pkg.go.dev/reflect#PtrTo):

> PtrTo is the old spelling of PointerTo. The two functions behave identically.
Copilot AI review requested due to automatic review settings September 5, 2025 22:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates deprecated reflect constants and functions to their current counterparts. The changes replace the deprecated reflect.Ptr with reflect.Pointer and reflect.PtrTo with reflect.PointerTo throughout the codebase to align with Go's current reflect package API.

  • Replace all instances of reflect.Ptr with reflect.Pointer
  • Replace reflect.PtrTo with reflect.PointerTo
  • Update switch cases and conditional checks to use the new constants

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
yaml.go Updates pointer kind checks in decoder methods and struct info processing
sorter.go Updates pointer kind checks in key comparison logic
internal/testutil/assert/assert.go Updates pointer kind checks in assertion utilities
encode.go Updates pointer kind checks in marshaling logic
decode.go Updates pointer kind checks in unmarshaling logic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ccoVeille
Copy link
Contributor

ccoVeille commented Sep 6, 2025

I like your PR that supersedes #29 in its attempt.

I feel like I will close #29 at some point or complete it with my own commits.

But your PR is fine and limited. So I like it the way you did

Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ingydotnet ingydotnet merged commit 38dfe5a into yaml:main Sep 6, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants