Closed razor-1 closed 4 years ago
Hi @razor-1 , Thanks for your contribution! I'd like to see your proposal as a PR whenever you can. I'm always up for a DRY-up, but not so sure about changing a public interface to improve the code.
Let's see the proposal. and discuss our options.
Thank you, I tried to minimize public interface changes in #44 as much as possible but there may still be room for improvement.
Merged!
There's a fair amount of duplicate code in po.go and mo.go. Running golangci-lint with dupl enabled yields:
mo.go:279: 279-330 lines are duplicate of
po.go:307-358
(dupl) po.go:307: 307-358 lines are duplicate ofmo.go:279-330
(dupl) mo.go:449: 449-472 lines are duplicate ofpo.go:478-501
(dupl) po.go:478: 478-501 lines are duplicate ofmo.go:449-472
(dupl)I would propose some refactoring to move this common code into a new file,
domain.go
. I have done this successfully in a branch and it can be done with minimal changes to the public methods, though there may be enough change to warrant this being v2.This will also allow cleaning up some duplicate tests.