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

documentation: fix typo in RegisterCodec godoc #5306

Merged
merged 2 commits into from
Apr 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion encoding/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var registeredCodecs = make(map[string]Codec)
// more details.
//
// NOTE: this function must only be called during initialization time (i.e. in
// an init() function), and is not thread-safe. If multiple Compressors are
// an init() function), and is not thread-safe. If multiple Codecs are
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem like the right change. This is to register codecs, not compressors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Line 72 is the same as line 111. I think line 72 is right, but the comment is for RegisterCodec(...) in line111.
And like you said "This is to register codecs, not compressors." so, the comment should be changed codecs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Line 72 is for function RegisterCompressor, and line 111 is for RegisterCodec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

However, it seem like we can register compressors to RegisterCodec according to the unmodified comments.

Actually we can only register codecs to RegisterCodec according to the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohhhh, sorry. I see. I read it wrong.
Yeah this look like the right fix. Thanks for the change!

// registered with the same name, the one registered last will take effect.
func RegisterCodec(codec Codec) {
if codec == nil {
Expand Down