Got a Panic error
Closed this issue ยท 2 comments
tormath1 commented
Hey ๐ !
Thanks for this hook. However, I got an error after a few moment:
INFO[0002] nothing to do
panic: send on closed channel
goroutine 16 [running]:
github.com/tormath1/ad-mattermost/vendor/github.com/shuLhan/mattermost-integration/hooks/logrus.consumer.func1(0x0, 0x0, 0xc42046b75a, 0x2)
/home/mathieu/go/src/github.com/tormath1/ad-mattermost/vendor/github.com/shuLhan/mattermost-integration/hooks/logrus/logrus.go:120 +0xa0
created by github.com/tormath1/ad-mattermost/vendor/github.com/shuLhan/mattermost-integration/hooks/logrus.consumer
/home/mathieu/go/src/github.com/tormath1/ad-mattermost/vendor/github.com/shuLhan/mattermost-integration/hooks/logrus/logrus.go:116 +0x173
exit status 2
The message has been successfully sent to Mattermost, but the program himself crash.
logrus.Info("nothing to do")
mmlogrus.Stop()
This is my go code.
If I remove mmlogrus.Stop()
everything is ok but message is not sent. Do you have any hint ? ๐
tormath1 commented
By removing these lines
out:
- select {
- case <-_chanSent:
- default:
- close(_chanSent)
- }
_wg.Done()
It works as expected and without crash.
shuLhan commented
Thanks for reporting. Somethings must be left from debugging. Can you do PR?