Closed tjtelan closed 5 years ago
The bulk of this refactor was to achieve 3 things in the codebase:
Break out the common
package
There were a lot of very specific tasks left in this package namespace. A lot of this resulted in splitting out code within a file into multiple different packages, then using the compiler to tell me when a function call in the common package no longer worked due to scope breakages.
Reorganize the codebase in a more functional layout The new top-level layout still requires some fine tuning, but the code is laid out in a hopefully more improved, easier to scan way.
deprecate guideOcelotStruct.go
by replacing it with more interfaces so that we could break it into multiple packages.
Since the GuideOcelot service protobuf is defined as one giant service wrapper, this gets compiled as a single interface with ~52 individual functions.
Getting started on this was actually the worst part of this entire effort. The OcelotStructAPI struct took in the now deleted guideOcelotStruct under DeprecatedHandle , and I changed everything in the codebase to reference that handle. I made sure I could swap the structs out and that compilation still worked.
Then I slowly introduced more interfaces, and embedded them into OcelotStructAPI as I removed them from guideOcelotStruct using the compiler as validation.
This required a lot of duplication of code for implementing collection of creds. I'm pretty sure that is just the cost of splitting everything out. But at least I don't need to jump around files to read an interface.
Before I forget:
Many of the tests were disabled, and placed in a top-level test/
directory. At the moment, I trust functional tests a little more than our unit tests. Rather than delete them immediately, I wanted to review them first.
In preparation for #214
Fixes #107 Fixes #186 Fixes #182 - (Also the casing in Go is a matter of syntax.) Fixes #190