- Reflection
- Change modifier to
protected
and put tests into same place
/github.com/example/mypackage.go
/mypackage_internal_test.go
fn private_function() {
}
#[test]
fn test_private_function() {
private_function()
}
No private/public, do whatever you want
- have faith in your unit tests: when they test the public api of your module they also test the private api
- write more tests for your public api, have you covered all scenarios ?
- extract your private api to its own module, most functions should become public and testable
- subclassing the class to expose access
- tricks with runtime introspective features
- Reflection or other access modifier tricks similar to Java
- Friend access modifer
- macro
- subclassing
- refactor to separate file and expose interfaces
- Send (dynamic dispatch)