jakobottar / ava-go

Discord bot written in Go
MIT License
1 stars 1 forks source link

Environment Variable-based Authentication #10

Closed jakobottar closed 2 years ago

jakobottar commented 2 years ago
jakobottar commented 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?

Devcon4 commented 2 years ago

@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.