tektoncd/pipeline

Fix capitalized error messages to follow Go conventions

Aperta

#9500 aperta il 4 mar 2026

 (2 commenti) (0 reazioni) (1 assegnatario)Go (1943 fork)auto 404
good first issuehelp wantedkind/cleanup

Metriche repository

Star
 (9013 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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

Guida contributor