Hello,

 

I am starting to learn generics and I was wondering if the following code could 
be refactored to use genercis, in order to avoid using per type Make() method.

 

https://go.dev/play/p/gE4Z6Zj19Is

 

I have 3 identical structs, they are defined with different types and used in 
other types by their unique types. The function to create all 3 types can be 
consolidated as the actual structure of is the same.

 

I am curious it would be possible to leverage generics for this. I have made an 
attempt but I still need to use per type Make method.

 

Thank you and appreciate a lot your help.

 

Serguei

-- 
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/D41C14EF-35D1-434F-A719-1E8C88D90C0F%40gmail.com.

Reply via email to