I recognize that idiomatic Go would normally have a value, error return value, so this may not necessarily apply, but the test invalid_planet_causes_error expects a value of -1.0 rather than the zero value of float64 which would be more standard. Should it be corrected to maintain consistency?
Yeah. Returning a single value is … not very idiomatic ![]()
If it returned 0 for errors, how would you differentiate an error from 0 seconds? Using -1 for errors is idiomatic C, which is probably what this is mirroring.
That’s a good point! I didn’t consider that case. I suppose that doing it this way can also help teach users to read test cases to see what the expectations may be in a given project
Exercism relies heavily on the TDD model. In most cases, users should be able to tell what’s needed from running the tests and reading the test output. You can read the test cases but generally shouldn’t need to.
Like you mentioned, I’d expect (float64, error) to be returned. Other Go exercises follow this approach when error handling is required so it makes sense for the exercise to be updated to use that idiom.