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

Merkle db fix new return type #1898

Merged
merged 4 commits into from
Aug 23, 2023
Merged

Merkle db fix new return type #1898

merged 4 commits into from
Aug 23, 2023

Conversation

dboehm-avalabs
Copy link
Contributor

The New function on merkledb currently returns an unexported type instead of the exported interface. This PR fixes the return type and adds a test only new function that tests can use to access unexported fields.

@danlaine
Copy link

As it stands, the exported methods of merkleDB are still callable outside the merkledb package, so I don't think this really buys us anything. On the other hand, in avalanchego we do generally return interfaces rather than structs. We should probably have a larger discussion about whether we should return structs and accept interfaces in all of avalanchego.

@joshua-kim pointed me to this article and I think it makes reasonable points https://bryanftan.medium.com/accept-interfaces-return-structs-in-go-d4cab29a301b

@danlaine danlaine merged commit a37bb0a into dev Aug 23, 2023
16 checks passed
@danlaine danlaine deleted the MerkleDBFixNewReturnType branch August 23, 2023 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants