re: Golang Patterns - Part 2 VIEW POST

VIEW FULL DISCUSSION

I'm a major novice (and not in the better way of interpretation) in Go, but to clarify:

func WalkInWordGrams(walker WordgramWalker) error {

in your first code block, you had not set up the WordgramWalker type, so you couldn't use this could you? You would have had to had the func defined as:

func WalkInWordGrams(walker func(wordgram *wordgrams.WordGram) error) error {

Or something along these lines?

Really interesting read, I just wanted to make sure I understood :D

You are right, nice catch.
The example would fail to compile, because WordgramWalker is not defined.
The Ctr+C && Ctr+V pattern failed me XD

Thanks for reading and letting me know about the mistake!
I have updated the example with the correction :)

code of conduct - report abuse