Skip to content

Commit

Permalink
feat(golangci): Add golangci-lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jul 12, 2024
1 parent 1043a4a commit af1b312
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 6 deletions.
81 changes: 81 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand Down
6 changes: 2 additions & 4 deletions internal/game/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}

Expand Down

0 comments on commit af1b312

Please sign in to comment.