Coming from years of Java, I recently picked up Golang and I wondered how the somewhat different paradigm affects common practices. Most importantly: If I define a struct and I want to have a function which works on that struct (aka a method), do I define the function as "belonging" to the struct or do I rather pass the pointer to that struct in an own function body? In other terms:
func (c *Component) initState()
or
func initState(c *Component)
Does either one have advantage over the other (other than e.g. readability for Java users or semantic clarity), as there are no real object/class concepts in Golang? I'd mostly go for the first alternative, but my view may be biased by working in an object-oriented world for some time, that's why I'm asking.