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

Export reserved range constants #53

Merged
merged 4 commits into from
Jul 23, 2021
Merged

Export reserved range constants #53

merged 4 commits into from
Jul 23, 2021

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Jul 22, 2021

No description provided.

@rvagg rvagg requested a review from mvdan July 22, 2021 09:18
@rvagg
Copy link
Member Author

rvagg commented Jul 22, 2021

OK, well that's not as easy as it seems, stringer is pull those out as if they were codes, see https://github.com/multiformats/go-multicodec/runs/3132456370?check_suite_focus=true

@mvdan what's the intention here? I've committed the build version, see cd32040, is this appropriate for these values given that they're not truly codecs, but meant to be simple constants. Is it OK that they get tangled up in the generated stuff?

@mvdan
Copy link
Contributor

mvdan commented Jul 22, 2021

Hmm, yeah, it's not great to expose these with names as if they were registered codes.

How about making them untyped constants, like const Foo = 123? Then stringer won't pick them up.

They'll lack the Code type, but I think that's right - they are not codes. They are simply helpful constants. And, since they are untyped Go constants, they can be converted to any integer type easily, including Code.

Copy link
Contributor

@mvdan mvdan left a comment

Choose a reason for hiding this comment

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

SGTM if you drop the type and re-generate

code.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@rvagg
Copy link
Member Author

rvagg commented Jul 22, 2021

cool, dropped the Code and it's much nicer, fixed up nits

Copy link
Contributor

@mvdan mvdan left a comment

Choose a reason for hiding this comment

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

SGTM! I assume you'll squash-merge?

@rvagg
Copy link
Member Author

rvagg commented Jul 23, 2021

I assume you'll squash-merge?

Assume nothing! Keeping up with people's preferences around commits is tricky and I find Go git preferences to be quite different to JS so I use git history to make a guess about style. I'm not really sure what to make of the git history here though.

Will squash.

@rvagg rvagg merged commit 52a3ac5 into master Jul 23, 2021
@rvagg rvagg deleted the rvagg/reserved branch July 23, 2021 01:18
@aschmahmann aschmahmann mentioned this pull request Aug 23, 2021
62 tasks
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.

2 participants