diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..6783432 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,81 @@ +run: + timeout: 5m + +issues: + max-same-issues: 50 + +linters: + enable: + - asasalint + - asciicheck + - bidichk + - bodyclose + - copyloopvar + - decorder + - dupl + - durationcheck + - err113 + - errcheck + - errname + - errorlint + - exportloopref + - forbidigo + - gci + - ginkgolinter + - gocheckcompilerdirectives + - gochecknoglobals + - gochecknoinits + - gochecksumtype + - goconst + - gocritic + - godox + - gofumpt + - goheader + - goimports + - gomoddirectives + - gomodguard + - goprintffuncname + - gosec + - gosimple + - gosmopolitan + - govet + - importas + - inamedparam + - ineffassign + - interfacebloat + - intrange + - loggercheck + - makezero + - mirror + - musttag + - nakedret + - nilerr + - nilnil + - noctx + - nolintlint + - nonamedreturns + - nosprintfhostport + - perfsprint + - prealloc + - predeclared + - promlinter + - protogetter + - reassign + - revive + - rowserrcheck + - sloglint + - spancheck + - sqlclosecheck + - staticcheck + - stylecheck + - tenv + - testableexamples + - testifylint + - typecheck + - unconvert + - unparam + - unused + - usestdlibvars + - wastedassign + - whitespace + - zerologlint diff --git a/cmd/cmd.go b/cmd/cmd.go index 67ab07b..0d43d39 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -19,7 +19,7 @@ func New() *cobra.Command { cmd.Flags().StringP(config.FileFlag, "f", "", "Loads a pattern file on startup") if err := cmd.RegisterFlagCompletionFunc(config.FileFlag, - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { return []string{".rle", ".cells"}, cobra.ShellCompDirectiveFilterFileExt }, ); err != nil { @@ -31,7 +31,7 @@ func New() *cobra.Command { return cmd } -func run(cmd *cobra.Command, args []string) error { +func run(cmd *cobra.Command, _ []string) error { if shell := cmd.Flag(config.CompletionFlag).Value.String(); shell != "" { return completion(cmd, shell) } diff --git a/internal/game/game.go b/internal/game/game.go index de298af..d58a987 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -72,10 +72,8 @@ func (g Game) Update(msg tea.Msg) (tea.Model, tea.Cmd) { ny = 0 } neighbors += g.tiles[ny][nx] - } else { - if ny >= 0 && ny < len(g.tiles) && nx >= 0 && nx < len(g.tiles[ny]) { - neighbors += g.tiles[ny][nx] - } + } else if ny >= 0 && ny < len(g.tiles) && nx >= 0 && nx < len(g.tiles[ny]) { + neighbors += g.tiles[ny][nx] } }