How to deal with publicly exposed constant and data structure when using
packageA +--- publicAPI.go +--- publicHelper.go +--- publicConstant.go +--- publicDataStructure.go +--- ... +--- internal +--- privateAction1.go +--- privateAction2.go +--- ...
The idea was to isolate private implementations from the publicly exposed source codes. However, these
private implementations need to access the Public available constant like
It is understood that public imports the
internal package for operations. However, if the
internal imports back the public package, we get a cyclic import problem. Re-declaring public constants between the packages makes no sense in terms of maintenance.
For data structure, we can workaround by redefining the data structure type against the internal version.