From b02495c8ffce845a5af03250459f26e01c0ff76c Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Tue, 10 Feb 2026 10:19:43 +0100 Subject: [PATCH] fix(github-interceptor): use Error instead of Errorf for non-format strings Go 1.24's stricter vet checks flag non-constant format strings passed to printf-like functions. The code was incorrectly using Errorf with err.Error() as the format string, which could cause issues if the error message contained % characters. This change uses Error() instead of Errorf() when no format arguments are needed, fixing the lint errors that were blocking dependabot PRs (#2939, #2961, #3036). /kind bug Signed-off-by: Vincent Demeester --- tekton/ci/interceptors/github/pkg/github/issue_comment.go | 2 +- tekton/ci/interceptors/github/pkg/github/pull_request.go | 2 +- tekton/ci/interceptors/github/pkg/github/push.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tekton/ci/interceptors/github/pkg/github/issue_comment.go b/tekton/ci/interceptors/github/pkg/github/issue_comment.go index 178fc9d8d..34faf8c1a 100644 --- a/tekton/ci/interceptors/github/pkg/github/issue_comment.go +++ b/tekton/ci/interceptors/github/pkg/github/issue_comment.go @@ -22,7 +22,7 @@ type IssueComment struct{} func (c *IssueComment) Execute(ctx context.Context, client *github.Client, cfg *pb.Config, req *v1alpha1.InterceptorRequest) (*v1alpha1.InterceptorResponse, error) { event := new(github.IssueCommentEvent) if err := json.Unmarshal([]byte(req.Body), event); err != nil { - return nil, Errorf(codes.InvalidArgument, err.Error()) + return nil, Error(codes.InvalidArgument, err.Error()) } if event.GetAction() != "created" { diff --git a/tekton/ci/interceptors/github/pkg/github/pull_request.go b/tekton/ci/interceptors/github/pkg/github/pull_request.go index 59dc4b1a6..5de95ce30 100644 --- a/tekton/ci/interceptors/github/pkg/github/pull_request.go +++ b/tekton/ci/interceptors/github/pkg/github/pull_request.go @@ -26,7 +26,7 @@ type PullRequest struct{} func (c *PullRequest) Execute(ctx context.Context, client *github.Client, cfg *pb.Config, req *v1alpha1.InterceptorRequest) (*v1alpha1.InterceptorResponse, error) { event := new(github.PullRequestEvent) if err := json.Unmarshal([]byte(req.Body), event); err != nil { - return nil, Errorf(codes.InvalidArgument, err.Error()) + return nil, Error(codes.InvalidArgument, err.Error()) } if cfg.GetPullRequest() == nil { diff --git a/tekton/ci/interceptors/github/pkg/github/push.go b/tekton/ci/interceptors/github/pkg/github/push.go index c372b5543..2a9fbe679 100644 --- a/tekton/ci/interceptors/github/pkg/github/push.go +++ b/tekton/ci/interceptors/github/pkg/github/push.go @@ -21,7 +21,7 @@ type Push struct{} func (c *Push) Execute(ctx context.Context, client *github.Client, cfg *pb.Config, req *v1alpha1.InterceptorRequest) (*v1alpha1.InterceptorResponse, error) { event := new(github.PushEvent) if err := json.Unmarshal([]byte(req.Body), event); err != nil { - return nil, Errorf(codes.InvalidArgument, err.Error()) + return nil, Error(codes.InvalidArgument, err.Error()) } if cfg.GetPush() == nil {