One possibility is copy-paste the structure and convert at call boundaries.

https://play.golang.org/p/5LFw6U3yi6

But, can you show a real-world example to ground the conversation?

+ Egon

On Monday, 13 November 2017 08:48:18 UTC+2, dc0d wrote:
>
> It is a Go best practice to "accept interfaces, return concrete types". 
> Which helps greatly in implementing different architectures/designs (like 
> Clean Architecture or the like).
>
> There are times that a package is used which returns fat structs (as the 
> concrete type) - mostly POGO.
>
> Problem:
> Redefining some domain models for those payloads is cumbersome and 
> sometimes impractical. At the same time using them directly, exposes other 
> packages to that package that we want to abstract out it's functionality. 
> Some unwelcome dependency.
>
> Question:
> Should we redefined all those data types in upper layers for using them? 
> If no what is the solution?
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to