Closed jakobottar closed 2 years ago
@Devcon4 Single line error handling is pretty clean, like:
if err := bot.Start(); err != nil {
log.Fatalln("\u001b[31mERROR:\u001b[0m", err.Error())
}
But in some places when the function returns a value and an error, I think it feels kinda messy. Like in this context:
goBot, err := discordgo.New("Bot " + token)
if err != nil {
return
}
Should I change the second example to a single-line statement like the top for consistency, or should I leave it as-is?
@jakobottar sorry didn't see this. The second one is fine. you can only do inline errors if you don't need a result from the func.