Description
Go 1.26 introduced //go:fix inline — a directive that allows go fix and IDEs to automatically rewrite call sites of deprecated functions, type aliases, and variables to their modern replacements. See the Go blog post for details.
There are two sides to this for tektoncd/chains:
-
As a consumer: Once tektoncd/pipeline adds //go:fix inline annotations to its deprecated APIs, chains can run go fix ./... to auto-migrate (e.g. v1beta1 type aliases, deprecated resolution APIs).
-
As a library: chains has its own deprecated types that could benefit from annotation.
Prerequisite
Bump go.mod to Go 1.26 (currently at 1.25.5).
Opportunities
Deprecated Storage Backends
The following storage backends are deprecated in favor of Storer:
pkg/chains/storage/tekton/tekton.go — Backend struct (deprecated, use Storer instead)
pkg/chains/storage/gcs/gcs.go — Backend struct
pkg/chains/storage/oci/legacy.go — Backend struct
If there are constructor functions like NewStorageBackend() that simply wrap the new API, those can be annotated with //go:fix inline:
// Deprecated: use NewStorer instead.
//
//go:fix inline
func NewStorageBackend(ps versioned.Interface) *Backend {
return &Backend{pipelineclientset: ps}
}
Consuming pipeline's annotations
Once tektoncd/pipeline annotates its deprecated APIs (tektoncd/pipeline#9560), running go fix ./... in chains will automatically migrate:
v1beta1.ArrayOrString → v1beta1.ParamValue
- Deprecated resolution package imports
- Other deprecated type aliases and wrapper functions
References
Description
Go 1.26 introduced
//go:fix inline— a directive that allowsgo fixand IDEs to automatically rewrite call sites of deprecated functions, type aliases, and variables to their modern replacements. See the Go blog post for details.There are two sides to this for tektoncd/chains:
As a consumer: Once tektoncd/pipeline adds
//go:fix inlineannotations to its deprecated APIs, chains can rungo fix ./...to auto-migrate (e.g. v1beta1 type aliases, deprecated resolution APIs).As a library: chains has its own deprecated types that could benefit from annotation.
Prerequisite
Bump
go.modto Go 1.26 (currently at 1.25.5).Opportunities
Deprecated Storage Backends
The following storage backends are deprecated in favor of
Storer:pkg/chains/storage/tekton/tekton.go—Backendstruct (deprecated, useStorerinstead)pkg/chains/storage/gcs/gcs.go—Backendstructpkg/chains/storage/oci/legacy.go—BackendstructIf there are constructor functions like
NewStorageBackend()that simply wrap the new API, those can be annotated with//go:fix inline:Consuming pipeline's annotations
Once tektoncd/pipeline annotates its deprecated APIs (tektoncd/pipeline#9560), running
go fix ./...in chains will automatically migrate:v1beta1.ArrayOrString→v1beta1.ParamValueReferences