tektoncd/pipeline
Replace `nil, nil` returns with sentinel errors in status helpers
Aberta
#9.494 aberto em 4 de mar. de 2026
good first issuehelp wantedkind/cleanup
Métricas do repositório
- Stars
- (9.013 estrelas)
- Métricas de merge de PR
- (Mesclagem média 9d 3h) (137 fundiu PRs em 30d)
Description
Summary
Several functions in the status packages return nil, nil (no result and no error) to indicate "not found" or "not applicable" conditions. Each has a //nolint:nilnil comment noting that a sentinel error would be more ergonomic. This makes callers harder to reason about since they must check both return values for nil.
Locations
pkg/pod/status.go:
- Line 569:
return nil, nil //nolint:nilnil // would be more ergonomic to return a sentinel error - Line 584:
return nil, nil //nolint:nilnil // would be more ergonomic to return a sentinel error
pkg/status/status.go:
- Line 42:
return nil, nil //nolint:nilnil // would be more ergonomic to return a sentinel error - Line 60:
return nil, nil //nolint:nilnil // would be more ergonomic to return a sentinel error
What to do
- Define sentinel errors in the appropriate package, e.g.:
var ErrNotFound = errors.New("resource not found") - Replace
return nil, nilwithreturn nil, ErrNotFound(or a more descriptive sentinel) - Update callers to use
errors.Is(err, ErrNotFound)instead of checking fornilresult - Remove the
//nolint:nilnilcomments
How to find callers
# Find functions that return nil, nil
rg "return nil, nil" pkg/pod/status.go pkg/status/status.go
# Find callers of those functions to update
# (use your IDE or grep for the function names)
How to verify
go build ./...passesgo test ./pkg/pod/... ./pkg/status/...passesgo vet ./...passes- The
nilnillinter no longer needs to be suppressed for these locations
/kind cleanup