Skip to content

Use standardized hash.CloneHash interface#81

Merged
gdams merged 2 commits intomainfrom
clonestd
Jan 7, 2025
Merged

Use standardized hash.CloneHash interface#81
gdams merged 2 commits intomainfrom
clonestd

Conversation

@qmuntal
Copy link
Member

@qmuntal qmuntal commented Jan 7, 2025

Upstream will most likely define a standardized hash clone interface: golang/go#69521 (comment)

type CloneHash interface {
    hash.Hash
    Clone() hash.Hash
}

We should follow suite so that our hash types are compatible with upstream. The only difference with our current approach is that the new Clone method doesn't return an error, which makes sense given that other hash methods are not allowed to return an error. It is also unlikely that CNG will return an error when duplicating a hash unless there is a programmer error or the there is no memory available in the system, in which case it makes sense to panic anyway.

Co-authored-by: Davis Goodin <dagood@users.noreply.github.com>
@gdams gdams merged commit 9856e1e into main Jan 7, 2025
19 checks passed
@gdams gdams deleted the clonestd branch January 7, 2025 20:45
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.

3 participants