ReconfigureIO / reco

A command line tool for interacting with Reconfigure.io services
Apache License 2.0
6 stars 3 forks source link

Avoid reflection; use interfaces #29

Closed pwaller closed 6 years ago

pwaller commented 6 years ago

I think reflection was used here because 'tool' wasn't available until Init had been run. Instead, the NewClient invocation is hoisted to the global variable definition, and the reflection becomes unnecessary.

Furthermore, the clientImpl was being passed around by value quite a lot, and therefore copied. Copies were being taken of its state before loadAuth was called, resulting in requests lacking a token. Instead, we now only have one global clientImpl, which is constructed at variable initialisation time.

The motivation for this is to complete the rename of 'test' to 'simulation': gorename can't see through the reflection.