Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert: deprecate CompareType #1566

Merged
merged 4 commits into from Mar 19, 2024
Merged

assert: deprecate CompareType #1566

merged 4 commits into from Mar 19, 2024

Conversation

dolmen
Copy link
Collaborator

@dolmen dolmen commented Mar 5, 2024

Summary

Mark assert.CompareType as deprecated.

Changes

Commits step by step:

  • Refactor tests to free the compareResult symbol name: d75ed1d, 539cfd9
  • Rename CompareType to compareResult: fc30ce6
  • Reinstate CompareType but mark it as deprecated: 05f46a6

Motivation

assert.CompareType has been introduced by 0b4ff03 and published since v1.6.0, but it is in fact only for internal usage and should never have been exposed.

A search of usage of assert.CompareType on GitHub shows no results: https://github.com/search?q=assert.CompareType%20language%3AGo%20&type=repositories

Related issues

N/A

@dolmen dolmen added pkg-assert Change related to package testify/assert internal/refactor Refactor internals with no external visible changes internal/cleanup Internal change to ease maintenance without external impact labels Mar 5, 2024
@dolmen dolmen self-assigned this Mar 5, 2024
@dolmen
Copy link
Collaborator Author

dolmen commented Mar 6, 2024

Similar PR about deprecating a private type that should not have been exposed: #1441.

Refactor Test_compareTwoValuesCorrectCompareResult table test to be more
explicit: "compareTypes" renamed to "allowedResults".
Refactor compareTwoValues tests to free the 'compareResult' symbol name
(for incoming use of this name in next commit).
Rename CompareType to compareResult to make it private. This type is
used only in internal functions and is of no use for external users and
should never have been made public.

CompareType has been introduced by 0b4ff03
and appeared in releases since v1.6.0.

Note: strictly speaking, this is a breaking change, but no external user
should have ever used assert.CompareType as it made no sense in the assert
API. A search on GitHub has revealed no use of it.
https://github.com/search?q=assert.CompareType+language%3AGo&type=Repositories&ref=advsearch&l=Go&l=
Reinstate CompareType for full backward compatibility, but mark it as
deprecated.
@dolmen dolmen force-pushed the assert-deprecate-CompareType branch from 05f46a6 to a155d2a Compare March 19, 2024 23:47
@dolmen dolmen merged commit 404159f into master Mar 19, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal/cleanup Internal change to ease maintenance without external impact internal/refactor Refactor internals with no external visible changes pkg-assert Change related to package testify/assert
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants