Fix lint errors
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ryan Cavicchioni 2022-09-07 00:54:58 -05:00
parent e2032942ca
commit 446ac616bf
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
6 changed files with 16 additions and 16 deletions

4
.golangci.yml Normal file
View File

@ -0,0 +1,4 @@
---
linters:
disable:
- errcheck

View File

@ -72,7 +72,9 @@ func (b *Bot) RegisterHandlers() {
func Run() error {
setupConfig()
lib.SeedMathRand()
if err := lib.SeedMathRand(); err != nil {
log.Warn(err)
}
if C.DiscordToken == "" {
log.Fatalf("Discord token is not set")
@ -99,7 +101,7 @@ func Run() error {
defer dg.Close()
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM)
<-sc
log.Info("Shutting down")

View File

@ -77,7 +77,9 @@ func (b *Bot) CommandHandler() func(*discordgo.Session, *discordgo.MessageCreate
cmd.Config = b.Config
log.Debugf("command: %v, args: %v, nargs: %d", cmd.Name, args, len(args))
cmd.Func(args, m)
if err := cmd.Func(args, m); err != nil {
log.Errorf("failed to execute command: %s", err)
}
return
}

View File

@ -75,9 +75,7 @@ func (b *Bot) DealCommand() CommandFunc {
}
func JoinCards(h []Card, sep string) string {
var b []string
b = make([]string, len(h))
b := make([]string, len(h))
for i, v := range h {
b[i] = string(v)

View File

@ -36,7 +36,7 @@ func (g *Gun) Load(n int) {
g.N = 0
for i := 1; i <= n; {
x := lib.RandInt(0, len(g.C)-1)
if g.C[x] == false {
if !g.C[x] {
g.C[x] = true
i++
} else {
@ -58,7 +58,7 @@ func (g *Gun) Fire() bool {
func (g *Gun) IsEmpty() bool {
for _, v := range g.C {
if v == true {
if v {
return false
}
}

View File

@ -17,9 +17,7 @@ func Contains[T comparable](s []T, v T) bool {
}
func JoinInt(a []int, sep string) string {
var b []string
b = make([]string, len(a))
b := make([]string, len(a))
for i, v := range a {
b[i] = strconv.Itoa(v)
@ -37,11 +35,7 @@ func SumInt(a []int) int {
}
func Itob(v int) bool {
if v == 1 {
return true
}
return false
return v == 1
}
func BuildURI(rawuri, rawpath string) string {