Skip to content

Use //go:fix inline for deprecated storage backends and migrate off deprecated pipeline APIs #1583

@vdemeester

Description

@vdemeester

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:

  1. 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).

  2. 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.goBackend struct (deprecated, use Storer instead)
  • pkg/chains/storage/gcs/gcs.goBackend struct
  • pkg/chains/storage/oci/legacy.goBackend 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.ArrayOrStringv1beta1.ParamValue
  • Deprecated resolution package imports
  • Other deprecated type aliases and wrapper functions

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions