The assert it refers to is the C and other languages assert which makes the 
program fail immediately on not satisfying the condition and is used inline 
with the rest of the code. In short, the elements that make it bad Go style are 
1. adding the tests together with the running code and 2. having it crash the 
program.

The Go way of doing it is putting it away from the main program, keeping the 
main program always safe to run.

The testify assert copies semantics but not these problems, so there is no 
issue at all using it.

[Joop Kiefte - Chat @ 
Spike](https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=pmam2)   
[pmam2]

On October 3, 2020 at 16:05 GMT, jake <jake6...@gmail.com> wrote:

On Saturday, October 3, 2020 at 6:00:10 AM UTC-4 krish...@gmail.com wrote:

Hey,

Thanks for both the explanations. They really make sense to me.

I referred to the following link and thought assertions are against go best 
practices => https://golang.org/doc/faq#testing_framework.

I find the link, https://golang.org/doc/faq#testing_framework, to be confusing 
as well. I'm not clear on how the hypothetical "assert" it refers to is 
different from [testing.T.Fatal()](https://golang.org/pkg/testing/#T.Fatal).

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
[https://groups.google.com/d/msgid/golang-nuts/c96d148e-6b73-40d0-9e3c-b8666b2e9d6dn%40googlegroups.com](https://groups.google.com/d/msgid/golang-nuts/c96d148e-6b73-40d0-9e3c-b8666b2e9d6dn%40googlegroups.com?utm_medium=email&utm_source=footer).

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c-64693-kftyk78i-gpcida%3D1pebx9s%402.gethop.com.

Reply via email to