albenik / go-serial

A cross-platform serial library for go-lang (custom implementation based on http://go.bug.st/serial.v1)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why change Port from interface to struct in v2?

kmpm opened this issue · comments

I probably have missed something here but why change the Port type from interface to struct when changing to v2?
My guess is that there were some really big benefits.
With the bugst version I was able to create a mock port for testing stuff but that would require Port to be a interface I could implement. Mocking without interfaces i much harder.

@kmpm You can define an Interface at your side and then mock everything you need.

And please look here https://github.com/golang/go/wiki/CodeReviewComments#interfaces

Actually, the library does not require an interface for itself.