On Thu, Jan 10, 2019 at 6:24 PM 김용빈 <kyb...@gmail.com> wrote:

> I tried signal.Notify but it seems it doesn't work.
>
> Then I find this:
> https://github.com/golang/go/issues/15553#issuecomment-217162874
>
> So what should I do to make my function always run at exit in test?
>

A custom TestMain() is a good way to add setup and teardown functionality
around the entire test process:
https://golang.org/pkg/testing/#hdr-Main

It won't help you if you kill the "go test" process though. In that case
you would need a SIGTERM handler via signal.Notify()

> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to