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

fix(tm2): rename methods to avoid conflicts with (un)marshaler interfaces #3000

Merged
merged 3 commits into from
Nov 5, 2024

Conversation

mvertes
Copy link
Contributor

@mvertes mvertes commented Oct 22, 2024

Amino codec.MarshallJSON has the same method name as Go standard library json.Marshaler interface but with a different signature. This is rejected by go vet. The same applies for codec.UnmarshallJSON vs json.Unmarshaler. To fix that, we rename codec.MarshalJSON to codec.JSONMarshal and codec.UnmarshalJSON to codec.JSONUnmarshal.

Now `go vet ./...' pass on the full mono-repo.

Fixes #2954.

BREAKING CHANGE: rename tm2 amino exported methods.

Contributors' checklist...
  • [*] Added new tests, or not needed, or not feasible
  • [*] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • [*] Updated the official documentation or not needed
  • [*] No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • [*] Added references to related issues and PRs
  • Provided any useful hints for running manual tests

…aces

amino codec.MarshallJSON has the same method name than Go standard library
`json.Marshaler` interface but with a different signature. This is
rejected by `go vet`. The same applies for codec.UnmarshallJSON vs
`json.Unmarshaler`. To fix that, we rename codec.MarshalJSON to
codec.JSONMarshal and codec.UnmarshalJSON to codec.JSONUnmarshal.

Now `go vet ./...' pass on the full mono-repo.

Fixes gnolang#2954.
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.

Project coverage is 62.97%. Comparing base (95df7b0) to head (2486a3e).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
tm2/pkg/amino/amino.go 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3000      +/-   ##
==========================================
- Coverage   63.33%   62.97%   -0.36%     
==========================================
  Files         548      546       -2     
  Lines       78601    80221    +1620     
==========================================
+ Hits        49784    50523     +739     
- Misses      25461    26281     +820     
- Partials     3356     3417      +61     
Flag Coverage Δ
contribs/gnodev 60.49% <ø> (-0.63%) ⬇️
contribs/gnofaucet 14.82% <ø> (ø)
gno.land 67.37% <ø> (ø)
misc/genstd 79.72% <ø> (ø)
tm2 62.34% <42.85%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mvertes mvertes requested a review from a team as a code owner October 22, 2024 19:20
@thehowl
Copy link
Member

thehowl commented Oct 23, 2024

this looks good to me, but probably requires a check through @jaekwon .

@ltzmaxwell
Copy link
Contributor

very personal experience, but for the human brain, MarshalJSON and JSONMarshal are still easy to confuse. But otherwise LGTM.

@Kouteki Kouteki added the in focus Core team is prioritizing this work label Nov 1, 2024
@Kouteki
Copy link
Contributor

Kouteki commented Nov 4, 2024

this looks good to me, but probably requires a check through @jaekwon

Let's merge this PR; we'll roll back if Jae has any objections.

@mvertes mvertes merged commit 9096ef4 into gnolang:master Nov 5, 2024
57 of 59 checks passed
@mvertes mvertes deleted the gno-fix-method-names branch November 5, 2024 08:52
mvertes added a commit to mvertes/gno that referenced this pull request Nov 5, 2024
After merge of gnolang#3000, a few missing field names in struct literal
were reported. Fix it. No functional change.
@mvertes mvertes mentioned this pull request Nov 5, 2024
2 tasks
mvertes added a commit that referenced this pull request Nov 5, 2024
After merge of #3000, a few missing field names in struct literal were
reported. Fix it. No functional change.

<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [*] Added new tests, or not needed, or not feasible
- [*] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [*] Updated the official documentation or not needed
- [*] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
</details>
@Kouteki Kouteki removed the in focus Core team is prioritizing this work label Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Running go vet on the project fails.
4 participants