expected to be caught by the compiler or "go vet".
It appears that even if your function declares a return type, it will
compile without a proper return of that type so long as there is an
The behavior is documented here:
I suppose I expected that the compiler would have failed to compile my
program, or at least that "go vet" would have mentioned it since it seems
unlikely that I'd actually want to declare a function with a return type
but then implement the function in such a way as to never return any value
whatsoever. (if you do have a return statement after the for loop, "go vet"
will detect the unreachable code)
Thought I'd share and I'd love to hear other's thoughts on this behavior.
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 email@example.com.
For more options, visit https://groups.google.com/d/optout.