[bug] wrong formula in elons-toys exercise

Wrong formula for circle area in Elon’s-toys (Go track).
Now : 2 π R
Should be: π R²

Good find!

introduction.md should get fixed. Our Go maintainers are usually pretty quick with that.

PR just created: Fix code typo in introduction for elon-toys by sebastian0x62 · Pull Request #2659 · exercism/go (github.com)

Hi, guys. You are fast!)
Unfortunately, it won’t compile as it is now. Didn’t get it before being merged, sorry.

The problem is
math.Pow takes float64 as arguments, but circle radius is int.
I see 2 possible solutions:

  1. change radius type to float64 in circle struct
  2. or type convert it in formula like this
    math.Pow(float64(c.circle),2) * math.Pi

D’oh, sorry for that. Yeah, I actually didn’t check for the c.circle type. Should be variant 2 in my opinion.

1 Like

Ok, created a PR

My PR is closed as community PRs are paused. Please, create one yourself.

I just didn’t mentioned it here. The change was already queued.

@kolgushkinky Maintainers can re-open PRs, e.g. if there was a prior forum discussion and the outcome makes sense for the track like in this case.
However, we maintainers are often not very quick to react on the PRs. There is some patience needed.
I re-opened and approved your PR now. I will merge it later once CI has finished.
There was a duplicate PR by @sebastian0x62 but it was closed so I am going with yours now.