GoCracow #5 Golang and BDD

แชร์
ฝัง

ความคิดเห็น • 3

  • @TheSzczepan13
    @TheSzczepan13 5 ปีที่แล้ว

    In Go, panic should be reserved for situations where the error is unrecoverable and it doesn't make sense for normal execution to continue.

    • @gocracow
      @gocracow  5 ปีที่แล้ว

      That's right! That's why the test fails and another test can continue.

    • @bartomiejklimczak3407
      @bartomiejklimczak3407 4 ปีที่แล้ว +1

      that's true, in general. This usage is kinda different than in a normal production code because it's in tests. I changed the decision anyway a few months later but for a different reason - it was God damn hard to get the full stack trace when something goes wrong. This limitation was a huge deal when I tried to improve the debuggability of those tests. Right now, you can use just t.Error instead.