tektoncd/pipeline

Fix capitalized error messages to follow Go conventions

开放

#9,500 创建于 2026年3月4日

 (2 条评论) (0 个反应) (1 位负责人)Go (1,943 个派生)auto 404
good first issuehelp wantedkind/cleanup

仓库指标

星标
 (9,013 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Summary

Go convention is that error messages should not be capitalized (see Go Code Review Comments). There are ~22 instances of fmt.Errorf("Capital...") in non-test, non-vendor code.

Examples

// ❌ Current (capitalized)
fmt.Errorf("Error while extracting workspace: %s", errString)
fmt.Errorf("Could not parse image manifest: %w", err)
fmt.Errorf("Failed to read image layer: %w", err)
fmt.Errorf("PipelineRef for PipelineTask %q is not yet implemented", pipelineTask.Name)
fmt.Errorf("Result reference error: Could not find ref...")
fmt.Errorf("Provided results don't match declared results...")

// ✅ Fixed (lowercase)
fmt.Errorf("error while extracting workspace: %s", errString)
fmt.Errorf("could not parse image manifest: %w", err)
fmt.Errorf("failed to read image layer: %w", err)

How to find them

rg 'fmt\.Errorf\("[A-Z]' --type go --glob '!vendor/**' --glob '!pkg/client/**' --glob '!*_test.go' -n

Files affected (non-test production code)

  • pkg/workspace/apply.go
  • pkg/remote/oci/resolver.go
  • pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go
  • pkg/reconciler/taskrun/validate_taskrun.go
  • pkg/apis/pipeline/v1/result_validation.go
  • pkg/resolution/resolver/http/resolver.go
  • pkg/spire/test/pemutil/pem.go

Considerations

  • Only fix production code (not test files — test error messages are often user-facing assertions)
  • Be careful not to change errors that are intentionally formatted as sentences for user-facing messages (e.g., webhook validation responses)
  • Some errors wrapped with %w may be checked by callers via errors.Is() — changing the message is safe since only the type matters

How to verify

  • go build ./...
  • go test ./... for affected packages

/kind cleanup

贡献者指南