Hello. I started to study Go and started to interest such a topic: let's say I want to implement a data structure (in the code it is a certain struct ) in which slice will be stored, the type of elements of which is not known in advance, and write methods for it that will work with a slice, the type of elements which is unknown in advance. Is it possible? If, say, to make a cut of empty interfaces. If not, is it possible to solve such a thing on Go?

  • There are no templates in Go. But something can be implemented through interfaces. - user227465
  • @GreenDragon I know that. But is it possible to implement this particular thing using interfaces? - Jyree
  • Can. See, for example, how the standard sort package is implemented. - user227465
  • @GreenDragon I need a template data structure that will store an unknown array type. With functions, everything is clear. - Jyree
  • What kind of template data structure do you need? - user227465

0