Skip to content

Commit

Permalink
build(linter): fix makezero linter issue (hybridgroup#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
gen2thomas committed Jul 6, 2023
1 parent bc3d7d4 commit a6d6571
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ linters:
# currently active linters:
#
#INFO [lintersdb] Active 35 linters: [asasalint asciicheck bidichk contextcheck decorder depguard durationcheck errcheck exportloopref
# gocheckcompilerdirectives gomoddirectives gomodguard goprintffuncname gosimple govet grouper ineffassign mirror musttag
# gocheckcompilerdirectives gomoddirectives gomodguard goprintffuncname gosimple govet grouper ineffassign makezero mirror musttag
# nilerr nilnil nolintlint nosprintfhostport prealloc reassign revive staticcheck tagalign tenv testableexamples tparallel typecheck unused wastedassign]

enable-all: true
Expand Down Expand Up @@ -74,7 +74,6 @@ linters:
- zerologlint # not needed (related to zerolog package)
# important to have
- gofmt # important to prevent "format tsunami" ("gofmt -s -w" missed), disabled due to "https://github.com/golangci/golangci-lint-action/issues/535"
- makezero # very important (find/reduce bugs, e.g. in robot_work_test.go)
- nakedret # very useful together with "nonamedreturns" (reduce bugs)
- nonamedreturns # very useful (reduce bugs)
- unconvert # very useful (reduce bugs, simplify code)
Expand Down
6 changes: 4 additions & 2 deletions robot_work_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ func TestRobotAutomationFunctions(t *testing.T) {

func collectStringKeysFromWorkRegistry(rwr *RobotWorkRegistry) []string {
keys := make([]string, len(rwr.r))
for k := range rwr.r {
keys = append(keys, k)
var idx int
for key := range rwr.r {
keys[idx] = key
idx++
}
return keys
}

0 comments on commit a6d6571

Please sign in to comment.