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

feat: add interface #216

Merged
merged 2 commits into from
Sep 28, 2023
Merged

feat: add interface #216

merged 2 commits into from
Sep 28, 2023

Conversation

ardrabczyk
Copy link
Contributor

It'll be easier to mock candevice functionality in other packages.

It'll be easier to mock candevice functionality in other packages.
@ardrabczyk ardrabczyk requested a review from a team as a code owner September 28, 2023 08:50
Copy link
Member

@Edholm Edholm left a comment

Choose a reason for hiding this comment

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

It's good that we have an interface, but I'm not sure I agree with returning the interface from the New func.

Go generally follows "Accept interfaces, return structs" and since Go implicitly implements any matching interface, I don't think this justifies changing the function signature.

Could you give me an example where this solves a problem that can't be solved in another way?

@ardrabczyk
Copy link
Contributor Author

hmm indeed there is no need to change function signature here, I'll change it.

Could you give me an example where this solves a problem that can't be solved in another way?

Just want to add that of course nothing prevents users from defining interface in their own packages but it makes it easier for them if it's defined here.

Copy link
Member

@Edholm Edholm left a comment

Choose a reason for hiding this comment

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

Nice, could be useful 👍

@Edholm Edholm merged commit 1c5bf36 into einride:master Sep 28, 2023
1 check passed
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