Mantesh Jalihal

Co-Founder & CTO Lookalkitchen

  • @kumarmantesh
  • GitHub
  • LinkedIn

Emitted by Hugo

  • Slice Methods · GoMethodsSlice · Nov 18, 2015
  • In Go, slices can have methods too (indirectly). There can be so many use cases when slices can have methods. Have you ever come across a situation where you had a struct satisfying an interface but you had a slice of the same struct and hence you had to iterate over the slice and pass a single item eachtime to some function that accepted this interface? and imagine doing that multiple times in your code. Well, you don’t have to do that, there is a way for slices to have their own methods.