Re: [go-nuts] Handle errors in init

2022-03-09 Thread 'Axel Wagner' via golang-nuts
You likely shouldn't do that in the init function, but do it from main, where you have a clearly defined error handling path. There are ~four things you can do with an error in init: 1. Ignore it 2. Log it 3. Store it in a package-scoped variable and check that later 4. Panic Neither of these are

[go-nuts] Handle errors in init

2022-03-09 Thread Nikhilesh Susarla
I have an init func in a package. Inside the init function, I have a database initialization which returns error. How can I handle that error failure incase if it fails in the init function. Thank you Nikhilesh -- You received this message because you are subscribed to the Google Groups "go