amazon-ion / ion-go

A Go implementation of Amazon Ion.
https://amazon-ion.github.io/ion-docs/
Apache License 2.0
175 stars 31 forks source link

Move non-api files to internal folder #90

Closed R-maan closed 3 years ago

R-maan commented 4 years ago

To avoid exposing internal functions, we should move them into internal folder.

fernomac commented 4 years ago

I suspect (based on attempts of my own early on :)) that you're going to have a hard time moving too many implementation details into a separate package without creating dependency cycles. Go pretty strongly favors keeping implementation details as unexported types/functions in the same package that has the public API.

For ctxstack specifically, I think the relevant go-ism is "a little copying is better than a little dependency." :) It's not that big, I'd just copy/paste it over into cmd/ion-go.

therapon commented 3 years ago

A couple of attempts to move internal code to an internal folder run into the dependency issues. My take away here is that the use of internal folder works best when the code to be moved there is a sub-module and a leaf dependency. Else the controls provided by Go to expose or hide elements seems like the best option.

Resolving.