I was surprised to find that Go has a \'goto\' statement. I\'ve always been taught that \'goto\' statements are a thing of the past and evil for it occludes the actual flow
Goto statements has received a lot of discredit since the era of Spaghetti code in the 60s and 70s. Back then there was very poor to none software development methodology. However Goto are not natively evil but can of course be misused and abused by lazy or unskilled programmers. Many problems with abused Gotos can be solved with development processes such as team code reviews.
goto
are jumps in the same technical manner as continue
, break
and return
. One could argue that these are statements are evil in the same manner but they are not.
Why the Go team has included Gotos are probably because of the fact that it is a common flow control primitive. Additionally they hopefully concluded that the scope of Go excludes making an idiot-safe language not possible to abuse.