I have some types defined within their respective packages deep inside my 
project folder structure.

I create nested instances of these classes and print out their types in 
turn.

These can be seen in the following playground code:

https://go.dev/play/p/Juh7-IndBli

Running the code, one gets 

*beta.Beta[*play.ground/structs/alpha.Alpha[float64],*play.ground/structs/alpha.Alpha[string]]
 

*alpha.Alpha[*play.ground/structs/beta.Beta[*play.ground/structs/alpha.Alpha[float64],*play.ground/structs/alpha.Alpha[string]]]

If one inspects these types, they will realize that although the outer type 
is presented without writing out its full path, the inner types are fully 
qualified type paths.

The problem I am facing is that when I try to write tests of examples that 
involve some related nested type, I need to type in the full path of the 
type otherwise if I refactor the project's folder structure, the tests will 
fail simply because the fully qualified paths to the types has changed but 
nothing is actually wrong with the code.

So, my question is, how to get eg

*beta.Beta[*alpha.Alpha[float64], *alpha.Alpha[string]] 

and 

*alpha.Alpha[*beta.Beta[*alpha.Alpha[float64],*alpha.Alpha[string]]]

instead of what I actually get?

My first guess was to use regex's but it feels unnecessarily verbose. 
Hoping there's something else I'm missing.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ae2d2621-b312-4066-9fdd-aaebdbb14622n%40googlegroups.com.

Reply via email to