You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: a call to fmt.Sprint(e) inside the Error method will send the program into an infinite loop. You can avoid this by converting e first: fmt.Sprint(float64(e)). Why?
There is no explanation even though it is introduced.
The text was updated successfully, but these errors were encountered:
In "tour/methods/20" ("Exercise: Errors") just after the slide
explaining "calling code should handle errors by testing whether the
error equals nil" the example code in the errors exercise provides a
main that calls functions expecting error values and does not check
them. Checking error values is the expected go way of doing things and
should be shown. In the successful case it is also odd to show the "nil"
of no error when printing the correct answer (see golang/tour#273).
Printing the likely undefined float64 root value when there is an
error is also confusing.
Update "methods/exercise-errors.go" and matched solution to only print
error on error and only root otherwise.
Fixesgolang/tour#273Fixesgolang/tour#230
Context: https://tour.golang.org/methods/20
There is no explanation even though it is introduced.
The text was updated successfully, but these errors were encountered: