-
Notifications
You must be signed in to change notification settings - Fork 14
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
Document copying of type instances #194
Labels
documentation
Improvements or additions to documentation
enhancement
Improving existing functionality
Milestone
Comments
need only deep copy only, shallow copy can be done via |
smallhive
added a commit
that referenced
this issue
Sep 5, 2023
closes #194 Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
smallhive
added a commit
that referenced
this issue
Sep 6, 2023
closes #194 Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
smallhive
added a commit
that referenced
this issue
Sep 6, 2023
closes #194 Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
smallhive
added a commit
that referenced
this issue
Sep 6, 2023
closes #194 Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
smallhive
added a commit
that referenced
this issue
Sep 6, 2023
closes #194 Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
smallhive
added a commit
that referenced
this issue
Sep 7, 2023
closes #194 Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
smallhive
added a commit
that referenced
this issue
Sep 7, 2023
closes #194 Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
smallhive
added a commit
that referenced
this issue
Sep 7, 2023
closes #194 Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
smallhive
added a commit
that referenced
this issue
Sep 7, 2023
closes #194 Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
smallhive
added a commit
that referenced
this issue
Sep 7, 2023
closes #194 Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
roman-khimov
added a commit
that referenced
this issue
Sep 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
Improvements or additions to documentation
enhancement
Improving existing functionality
Context
Struct
type instances can be copied in two ways - Go assignment/passing tofunc
orchan
and dedicated methods (if provided). There are also two kinds of copying - shallow and deep. By default, shallow copying through assignment is expected by user if no particular methods or docs were provided.Overview
It's unsafe to do shallow copy some of SDK message types through assignment (e.g.
session.Token
which was encountered in #193: direct copying was not prevented by docs, and noCopy
method was provided, so mutability bug has been risen). We must protect the user from data corruption due to the mutability of copies.Proposal
Explore copying safety of all SDK types, and prevent direct copying by adding corresponding type docs and methods:
The text was updated successfully, but these errors were encountered: