diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fa4e8c0aa6..41ba91bfed 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,7 +13,7 @@ on: - 'feat/*' env: - GO_VERSION: 1.25.0 + GO_VERSION: 1.26.2 NODE_VERSION: 20.19.0 HELM_VERSION: 3.8.2 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index c296603a13..71b90fa769 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -14,9 +14,9 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: - GO_VERSION: 1.25.0 + GO_VERSION: 1.26.2 NODE_VERSION: 20.19.0 - GOLANGCI_LINT_VERSION: v2.4.0 + GOLANGCI_LINT_VERSION: v2.11.4 HELM_VERSION: 3.17.3 jobs: diff --git a/.github/workflows/publish_binary.yaml b/.github/workflows/publish_binary.yaml index f8e81daaac..89c92f9e6f 100644 --- a/.github/workflows/publish_binary.yaml +++ b/.github/workflows/publish_binary.yaml @@ -6,7 +6,7 @@ on: - 'v*' env: - GO_VERSION: 1.25.0 + GO_VERSION: 1.26.2 jobs: gh_release: diff --git a/.github/workflows/publish_pipedv1_exp.yaml b/.github/workflows/publish_pipedv1_exp.yaml index 5b2db71a0a..331b69317e 100644 --- a/.github/workflows/publish_pipedv1_exp.yaml +++ b/.github/workflows/publish_pipedv1_exp.yaml @@ -10,7 +10,7 @@ on: permissions: {} env: - GO_VERSION: 1.25.0 + GO_VERSION: 1.26.2 GHCR: ghcr.io GCR: gcr.io HELM_VERSION: 3.8.2 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 03799a12a7..33ed76433e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,7 +15,7 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: - GO_VERSION: 1.25.0 + GO_VERSION: 1.26.2 NODE_VERSION: 20.19.0 jobs: diff --git a/cmd/helloworld/Dockerfile b/cmd/helloworld/Dockerfile index bf284094df..e5332c4c27 100644 --- a/cmd/helloworld/Dockerfile +++ b/cmd/helloworld/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM --platform=$BUILDPLATFORM golang:1.25.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.26.2 AS builder ARG TARGETOS ARG TARGETARCH diff --git a/cmd/launcher/Dockerfile b/cmd/launcher/Dockerfile index 959da8efaa..6cdede796d 100644 --- a/cmd/launcher/Dockerfile +++ b/cmd/launcher/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM --platform=$BUILDPLATFORM golang:1.25.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.26.2 AS builder ARG TARGETOS ARG TARGETARCH diff --git a/cmd/launcher/Dockerfile-okd b/cmd/launcher/Dockerfile-okd index 55052aef28..3573111a4a 100644 --- a/cmd/launcher/Dockerfile-okd +++ b/cmd/launcher/Dockerfile-okd @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM --platform=$BUILDPLATFORM golang:1.25.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.26.2 AS builder ARG TARGETOS ARG TARGETARCH diff --git a/cmd/pipecd/Dockerfile b/cmd/pipecd/Dockerfile index 393e7620bb..0730d239c0 100644 --- a/cmd/pipecd/Dockerfile +++ b/cmd/pipecd/Dockerfile @@ -13,7 +13,7 @@ RUN make update/web-deps RUN make build/web # pipecd builder -FROM --platform=$BUILDPLATFORM golang:1.25.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.26.2 AS builder ARG TARGETOS ARG TARGETARCH diff --git a/cmd/pipecd/README.md b/cmd/pipecd/README.md index 941a5e8619..8f64e438fe 100644 --- a/cmd/pipecd/README.md +++ b/cmd/pipecd/README.md @@ -3,7 +3,7 @@ ## Prerequisites -- [Go 1.24 or later](https://go.dev/) +- [Go 1.26 or later](https://go.dev/) - [NodeJS v20.19.0 or later](https://nodejs.org/en/) - [Docker](https://www.docker.com/) - [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation) (If you want to run Control Plane locally) diff --git a/cmd/pipectl/Dockerfile b/cmd/pipectl/Dockerfile index b778f151cf..6bc1767b3d 100644 --- a/cmd/pipectl/Dockerfile +++ b/cmd/pipectl/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM --platform=$BUILDPLATFORM golang:1.25.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.26.2 AS builder ARG TARGETOS ARG TARGETARCH diff --git a/cmd/piped/Dockerfile b/cmd/piped/Dockerfile index df74dfb320..ae3e89bbf0 100644 --- a/cmd/piped/Dockerfile +++ b/cmd/piped/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM --platform=$BUILDPLATFORM golang:1.25.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.26.2 AS builder ARG TARGETOS ARG TARGETARCH diff --git a/cmd/piped/Dockerfile-okd b/cmd/piped/Dockerfile-okd index 16d7bda554..e644f3db63 100644 --- a/cmd/piped/Dockerfile-okd +++ b/cmd/piped/Dockerfile-okd @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM --platform=$BUILDPLATFORM golang:1.25.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.26.2 AS builder ARG TARGETOS ARG TARGETARCH diff --git a/cmd/piped/README.md b/cmd/piped/README.md index 42cb973eda..685b8bf70d 100644 --- a/cmd/piped/README.md +++ b/cmd/piped/README.md @@ -3,7 +3,7 @@ ## Prerequisites -- [Go 1.24 or later](https://go.dev/) +- [Go 1.26 or later](https://go.dev/) ## Repositories - [pipecd](https://github.com/pipe-cd/pipecd): contains all source code and documentation of PipeCD project. diff --git a/cmd/pipedv1/Dockerfile b/cmd/pipedv1/Dockerfile index fa7de5b751..5b4a682c6e 100644 --- a/cmd/pipedv1/Dockerfile +++ b/cmd/pipedv1/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM --platform=$BUILDPLATFORM golang:1.25.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.26.2 AS builder ARG TARGETOS ARG TARGETARCH diff --git a/cmd/pipedv1/README.md b/cmd/pipedv1/README.md index b886dfac0a..4b4378fd89 100644 --- a/cmd/pipedv1/README.md +++ b/cmd/pipedv1/README.md @@ -5,7 +5,7 @@ See [Overview of the Plan for Pluginnable PipeCD](https://pipecd.dev/blog/2024/1 ## Prerequisites -- [Go 1.24 or later](https://go.dev/) +- [Go 1.26 or later](https://go.dev/) ## Repositories - [pipecd](https://github.com/pipe-cd/pipecd): contains all source code and documentation of PipeCD project. diff --git a/docs/Dockerfile b/docs/Dockerfile index ffbb08259d..7e30924cb3 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.25.0-alpine3.22 AS builder +FROM golang:1.26.2-alpine3.22 AS builder COPY main.go . RUN go build -o /server main.go diff --git a/go.mod b/go.mod index e96d98542c..1965d53cca 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/pipecd -go 1.25.0 +go 1.26.2 require ( cloud.google.com/go/firestore v1.14.0 diff --git a/pkg/app/ops/firestoreindexensurer/gcloud.go b/pkg/app/ops/firestoreindexensurer/gcloud.go index 136b622942..d855290d18 100644 --- a/pkg/app/ops/firestoreindexensurer/gcloud.go +++ b/pkg/app/ops/firestoreindexensurer/gcloud.go @@ -76,12 +76,13 @@ func (c *gcloud) createIndex(ctx context.Context, idx *index) error { // For that, seems like additional permission is required. We have to look out for. // Run gcloud command in async mode, which returns immediately without waiting for the operation in progress to complete. - args := []string{ + args := make([]string, 0, 9+2*len(idx.Fields)) + args = append(args, "firestore", "indexes", "composite", "create", "--async", "--project", c.projectID, "--collection-group", idx.CollectionGroup, - } + ) for _, f := range idx.Fields { fieldCfg := fmt.Sprintf("field-path=%s", f.FieldPath) if f.Order != "" { diff --git a/pkg/app/ops/firestoreindexensurer/indexes.go b/pkg/app/ops/firestoreindexensurer/indexes.go index 9f3b127413..6a5883fd64 100644 --- a/pkg/app/ops/firestoreindexensurer/indexes.go +++ b/pkg/app/ops/firestoreindexensurer/indexes.go @@ -58,16 +58,16 @@ func (idx *index) validate() error { // id builds a unique string based on its fields. func (idx *index) id() string { var b strings.Builder - b.WriteString(fmt.Sprintf("%s/%s", idx.CollectionGroup, idx.QueryScope)) + fmt.Fprintf(&b, "%s/%s", idx.CollectionGroup, idx.QueryScope) fields := idx.Fields for _, f := range fields { - b.WriteString(fmt.Sprintf("/field-path:%s", f.FieldPath)) + fmt.Fprintf(&b, "/field-path:%s", f.FieldPath) if f.Order != "" { - b.WriteString(fmt.Sprintf("/order:%s", f.Order)) + fmt.Fprintf(&b, "/order:%s", f.Order) } if f.ArrayConfig != "" { - b.WriteString(fmt.Sprintf("/array-config:%s", f.ArrayConfig)) + fmt.Fprintf(&b, "/array-config:%s", f.ArrayConfig) } } return b.String() diff --git a/pkg/app/piped/controller/scheduler.go b/pkg/app/piped/controller/scheduler.go index 78fb95b238..6c5b888803 100644 --- a/pkg/app/piped/controller/scheduler.go +++ b/pkg/app/piped/controller/scheduler.go @@ -612,7 +612,7 @@ func (s *scheduler) executeStage(sig executor.StopSignal, ps model.PipelineStage // Skip the stage if needed based on the skip config. skip, err := s.shouldSkipStage(sig.Context(), input) if err != nil { - lp.Errorf("failed to check whether skipping the stage: %w", err.Error()) + lp.Errorf("failed to check whether skipping the stage: %s", err.Error()) if err := s.reportStageStatus(ctx, ps.Id, model.StageStatus_STAGE_FAILURE, ps.Requires); err != nil { s.logger.Error("failed to report stage status", zap.Error(err)) } diff --git a/pkg/app/piped/driftdetector/cloudrun/detector.go b/pkg/app/piped/driftdetector/cloudrun/detector.go index 5f31f520dc..034332bb49 100644 --- a/pkg/app/piped/driftdetector/cloudrun/detector.go +++ b/pkg/app/piped/driftdetector/cloudrun/detector.go @@ -326,7 +326,7 @@ func makeSyncState(r *provider.DiffResult, commit string) model.ApplicationSyncS } var b strings.Builder - b.WriteString(fmt.Sprintf("Diff between the defined state in Git at commit %s and actual live state:\n\n", commit)) + fmt.Fprintf(&b, "Diff between the defined state in Git at commit %s and actual live state:\n\n", commit) b.WriteString("--- Actual (LiveState)\n+++ Expected (Git)\n\n") details := r.Render(provider.DiffRenderOptions{ diff --git a/pkg/app/piped/driftdetector/ecs/detector.go b/pkg/app/piped/driftdetector/ecs/detector.go index 3b676dcaa6..1fa9287755 100644 --- a/pkg/app/piped/driftdetector/ecs/detector.go +++ b/pkg/app/piped/driftdetector/ecs/detector.go @@ -468,7 +468,7 @@ func makeSyncState(r *provider.DiffResult, commit string) model.ApplicationSyncS } var b strings.Builder - b.WriteString(fmt.Sprintf("Diff between the defined state in Git at commit %s and actual live state:\n\n", commit)) + fmt.Fprintf(&b, "Diff between the defined state in Git at commit %s and actual live state:\n\n", commit) b.WriteString("--- Actual (LiveState)\n+++ Expected (Git)\n\n") details := r.Render(provider.DiffRenderOptions{ diff --git a/pkg/app/piped/driftdetector/kubernetes/detector.go b/pkg/app/piped/driftdetector/kubernetes/detector.go index b1ae0f8195..2092ed8d91 100644 --- a/pkg/app/piped/driftdetector/kubernetes/detector.go +++ b/pkg/app/piped/driftdetector/kubernetes/detector.go @@ -399,7 +399,7 @@ func makeSyncState(r *provider.DiffListResult, commit string) model.ApplicationS } var b strings.Builder - b.WriteString(fmt.Sprintf("Diff between the defined state in Git at commit %s and actual state in cluster:\n\n", commit)) + fmt.Fprintf(&b, "Diff between the defined state in Git at commit %s and actual state in cluster:\n\n", commit) b.WriteString("--- Actual (LiveState)\n+++ Expected (Git)\n\n") details := r.Render(provider.DiffRenderOptions{ diff --git a/pkg/app/piped/driftdetector/lambda/detector.go b/pkg/app/piped/driftdetector/lambda/detector.go index 0f7ca0c342..1e56c52853 100644 --- a/pkg/app/piped/driftdetector/lambda/detector.go +++ b/pkg/app/piped/driftdetector/lambda/detector.go @@ -374,7 +374,7 @@ func makeSyncState(r *provider.DiffResult, commit string) model.ApplicationSyncS } var b strings.Builder - b.WriteString(fmt.Sprintf("Diff between the defined state in Git at commit %s and actual live state:\n\n", commit)) + fmt.Fprintf(&b, "Diff between the defined state in Git at commit %s and actual live state:\n\n", commit) b.WriteString("--- Actual (LiveState)\n+++ Expected (Git)\n\n") details := r.Render(provider.DiffRenderOptions{ diff --git a/pkg/app/piped/driftdetector/terraform/detector.go b/pkg/app/piped/driftdetector/terraform/detector.go index 43bb32c6db..895fbfef6e 100644 --- a/pkg/app/piped/driftdetector/terraform/detector.go +++ b/pkg/app/piped/driftdetector/terraform/detector.go @@ -301,7 +301,7 @@ func makeSyncState(r provider.PlanResult, commit string) (*model.ApplicationSync } var b strings.Builder - b.WriteString(fmt.Sprintf("Diff between the defined state in Git at commit %s and actual live state:\n\n", commit)) + fmt.Fprintf(&b, "Diff between the defined state in Git at commit %s and actual live state:\n\n", commit) b.WriteString("--- Actual (LiveState)\n+++ Expected (Git)\n\n") details, err := r.Render() diff --git a/pkg/app/piped/planner/kubernetes/kubernetes.go b/pkg/app/piped/planner/kubernetes/kubernetes.go index daeac6543f..f693485210 100644 --- a/pkg/app/piped/planner/kubernetes/kubernetes.go +++ b/pkg/app/piped/planner/kubernetes/kubernetes.go @@ -502,10 +502,10 @@ func determineVersion(manifests []provider.Manifest) (string, error) { // In case multiple containers are used // return version in format: "tag-1 (name-1), tag-2 (name-2)" var b strings.Builder - b.WriteString(fmt.Sprintf("%s (%s)", images[0].tag, images[0].name)) + fmt.Fprintf(&b, "%s (%s)", images[0].tag, images[0].name) for _, img := range images[1:] { - b.WriteString(fmt.Sprintf(", %s (%s)", img.tag, img.name)) + fmt.Fprintf(&b, ", %s (%s)", img.tag, img.name) } return b.String(), nil diff --git a/pkg/app/piped/platformprovider/cloudrun/diff.go b/pkg/app/piped/platformprovider/cloudrun/diff.go index 3ca3d1a0bb..00a19cf936 100644 --- a/pkg/app/piped/platformprovider/cloudrun/diff.go +++ b/pkg/app/piped/platformprovider/cloudrun/diff.go @@ -72,7 +72,7 @@ func (d *DiffResult) Render(opt DiffRenderOptions) string { } else { d, err := diffByCommand(diffCommand, d.Old, d.New) if err != nil { - b.WriteString(fmt.Sprintf("An error occurred while rendering diff (%v)", err)) + fmt.Fprintf(&b, "An error occurred while rendering diff (%v)", err) } else { b.Write(d) } diff --git a/pkg/app/piped/platformprovider/ecs/diff.go b/pkg/app/piped/platformprovider/ecs/diff.go index b42d0521b5..ac4e46ac6f 100644 --- a/pkg/app/piped/platformprovider/ecs/diff.go +++ b/pkg/app/piped/platformprovider/ecs/diff.go @@ -70,7 +70,7 @@ func (d *DiffResult) Render(opt DiffRenderOptions) string { } else { d, err := renderByCommand(diffCommand, d.Old, d.New) if err != nil { - b.WriteString(fmt.Sprintf("An error occurred while rendering diff (%v)", err)) + fmt.Fprintf(&b, "An error occurred while rendering diff (%v)", err) } else { b.Write(d) } diff --git a/pkg/app/piped/platformprovider/kubernetes/diff.go b/pkg/app/piped/platformprovider/kubernetes/diff.go index 48fb7856cb..8e517d26e7 100644 --- a/pkg/app/piped/platformprovider/kubernetes/diff.go +++ b/pkg/app/piped/platformprovider/kubernetes/diff.go @@ -150,11 +150,11 @@ func (r *DiffListResult) Render(opt DiffRenderOptions) string { index := 0 for _, delete := range r.Deletes { index++ - b.WriteString(fmt.Sprintf("- %d. %s\n\n", index, delete.Key.ReadableString())) + fmt.Fprintf(&b, "- %d. %s\n\n", index, delete.Key.ReadableString()) } for _, add := range r.Adds { index++ - b.WriteString(fmt.Sprintf("+ %d. %s\n\n", index, add.Key.ReadableString())) + fmt.Fprintf(&b, "+ %d. %s\n\n", index, add.Key.ReadableString()) } maxPrintDiffs := len(r.Changes) @@ -180,7 +180,7 @@ func (r *DiffListResult) Render(opt DiffRenderOptions) string { renderer := diff.NewRenderer(opts...) index++ - b.WriteString(fmt.Sprintf("# %d. %s\n\n", index, key.ReadableString())) + fmt.Fprintf(&b, "# %d. %s\n\n", index, key.ReadableString()) // Use our diff check in one of the following cases: // - not explicit set useDiffCommand option. @@ -191,7 +191,7 @@ func (r *DiffListResult) Render(opt DiffRenderOptions) string { // TODO: Find a way to mask values in case of using unix `diff` command. d, err := diffByCommand(diffCommand, change.Old, change.New) if err != nil { - b.WriteString(fmt.Sprintf("An error occurred while rendering diff (%v)", err)) + fmt.Fprintf(&b, "An error occurred while rendering diff (%v)", err) } else { b.Write(d) } @@ -205,7 +205,7 @@ func (r *DiffListResult) Render(opt DiffRenderOptions) string { } if prints < len(r.Changes) { - b.WriteString(fmt.Sprintf("... (omitted %d other changed manifests\n", len(r.Changes)-prints)) + fmt.Fprintf(&b, "... (omitted %d other changed manifests\n", len(r.Changes)-prints) } return b.String() diff --git a/pkg/app/piped/platformprovider/lambda/client.go b/pkg/app/piped/platformprovider/lambda/client.go index dedc0654bf..ddaa86723a 100644 --- a/pkg/app/piped/platformprovider/lambda/client.go +++ b/pkg/app/piped/platformprovider/lambda/client.go @@ -121,7 +121,7 @@ func (c *client) CreateFunction(ctx context.Context, fm FunctionManifest) error Layers: fm.Spec.Layers, } if len(fm.Spec.Architectures) != 0 { - var architectures []types.Architecture + architectures := make([]types.Architecture, 0, len(fm.Spec.Architectures)) for _, arch := range fm.Spec.Architectures { architectures = append(architectures, types.Architecture(arch.Name)) } diff --git a/pkg/app/piped/platformprovider/lambda/diff.go b/pkg/app/piped/platformprovider/lambda/diff.go index 81861da941..ef0920f358 100644 --- a/pkg/app/piped/platformprovider/lambda/diff.go +++ b/pkg/app/piped/platformprovider/lambda/diff.go @@ -69,7 +69,7 @@ func (d *DiffResult) Render(opt DiffRenderOptions) string { } else { d, err := diff.RenderByCommand(diffCommand, d.Old, d.New) if err != nil { - b.WriteString(fmt.Sprintf("An error occurred while rendering diff (%v)", err)) + fmt.Fprintf(&b, "An error occurred while rendering diff (%v)", err) } else { b.Write(d) } diff --git a/pkg/app/piped/platformprovider/terraform/terraform.go b/pkg/app/piped/platformprovider/terraform/terraform.go index b21dad89e9..74df9c32ca 100644 --- a/pkg/app/piped/platformprovider/terraform/terraform.go +++ b/pkg/app/piped/platformprovider/terraform/terraform.go @@ -116,10 +116,10 @@ func (t *Terraform) Version(ctx context.Context) (string, error) { } func (t *Terraform) Init(ctx context.Context, w io.Writer) error { - args := []string{ - "init", - } - args = append(args, t.makeCommonCommandArgs()...) + commonArgs := t.makeCommonCommandArgs() + args := make([]string, 0, 1+len(commonArgs)+len(t.options.initFlags)) + args = append(args, "init") + args = append(args, commonArgs...) args = append(args, t.options.initFlags...) cmd := exec.CommandContext(ctx, t.execPath, args...) @@ -274,12 +274,10 @@ func GetExitCode(err error) int { } func (t *Terraform) Plan(ctx context.Context, w io.Writer) (PlanResult, error) { - args := []string{ - "plan", - "-lock=false", - "-detailed-exitcode", - } - args = append(args, t.makeCommonCommandArgs()...) + commonArgs := t.makeCommonCommandArgs() + args := make([]string, 0, 3+len(commonArgs)+len(t.options.planFlags)) + args = append(args, "plan", "-lock=false", "-detailed-exitcode") + args = append(args, commonArgs...) args = append(args, t.options.planFlags...) var buf bytes.Buffer @@ -390,12 +388,10 @@ func parsePlanResult(out string, ansiIncluded bool) (PlanResult, error) { } func (t *Terraform) Apply(ctx context.Context, w io.Writer) error { - args := []string{ - "apply", - "-auto-approve", - "-input=false", - } - args = append(args, t.makeCommonCommandArgs()...) + commonArgs := t.makeCommonCommandArgs() + args := make([]string, 0, 3+len(commonArgs)+len(t.options.applyFlags)) + args = append(args, "apply", "-auto-approve", "-input=false") + args = append(args, commonArgs...) args = append(args, t.options.applyFlags...) cmd := exec.CommandContext(ctx, t.execPath, args...) diff --git a/pkg/app/piped/trigger/trigger.go b/pkg/app/piped/trigger/trigger.go index ccaabe46e6..08730747a4 100644 --- a/pkg/app/piped/trigger/trigger.go +++ b/pkg/app/piped/trigger/trigger.go @@ -412,7 +412,7 @@ func (t *Trigger) listCommandCandidates() []candidate { func (t *Trigger) listOutOfSyncCandidates() []candidate { var ( list = t.applicationLister.List() - apps = make([]candidate, 0) + apps = make([]candidate, 0, len(list)) ) for _, app := range list { if !app.IsOutOfSync() { @@ -432,7 +432,7 @@ func (t *Trigger) listOutOfSyncCandidates() []candidate { func (t *Trigger) listCommitCandidates() []candidate { var ( list = t.applicationLister.List() - apps = make([]candidate, 0) + apps = make([]candidate, 0, len(list)) ) for _, app := range list { apps = append(apps, candidate{ diff --git a/pkg/app/pipedv1/plugin/analysis/go.mod b/pkg/app/pipedv1/plugin/analysis/go.mod index 595b3cbec6..98de7c000d 100644 --- a/pkg/app/pipedv1/plugin/analysis/go.mod +++ b/pkg/app/pipedv1/plugin/analysis/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/analysis -go 1.25.0 +go 1.26.2 require ( github.com/DataDog/datadog-api-client-go v1.0.0-beta.16 diff --git a/pkg/app/pipedv1/plugin/cloudrun/go.mod b/pkg/app/pipedv1/plugin/cloudrun/go.mod index deccf80b85..dcbdf794fb 100644 --- a/pkg/app/pipedv1/plugin/cloudrun/go.mod +++ b/pkg/app/pipedv1/plugin/cloudrun/go.mod @@ -1,8 +1,6 @@ module github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/cloudrunservice -go 1.24.1 - -toolchain go1.24.2 +go 1.26.2 require ( github.com/creasty/defaults v1.6.0 diff --git a/pkg/app/pipedv1/plugin/ecs/go.mod b/pkg/app/pipedv1/plugin/ecs/go.mod index 71aa49a5cd..befbaae067 100644 --- a/pkg/app/pipedv1/plugin/ecs/go.mod +++ b/pkg/app/pipedv1/plugin/ecs/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/ecs -go 1.25.0 +go 1.26.2 require ( github.com/aws/aws-sdk-go-v2 v1.31.0 diff --git a/pkg/app/pipedv1/plugin/kubernetes/go.mod b/pkg/app/pipedv1/plugin/kubernetes/go.mod index e2adefc882..fdd0e00c42 100644 --- a/pkg/app/pipedv1/plugin/kubernetes/go.mod +++ b/pkg/app/pipedv1/plugin/kubernetes/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/kubernetes -go 1.25.0 +go 1.26.2 require ( github.com/creasty/defaults v1.6.0 diff --git a/pkg/app/pipedv1/plugin/kubernetes/livestate/plugin.go b/pkg/app/pipedv1/plugin/kubernetes/livestate/plugin.go index c3bd0769c8..6a4a9111d6 100644 --- a/pkg/app/pipedv1/plugin/kubernetes/livestate/plugin.go +++ b/pkg/app/pipedv1/plugin/kubernetes/livestate/plugin.go @@ -150,7 +150,7 @@ func calculateSyncState(diffResult *provider.DiffListResult, commit string) sdk. } var b strings.Builder - b.WriteString(fmt.Sprintf("Diff between the defined state in Git at commit %s and actual state in cluster:\n\n", commit)) + fmt.Fprintf(&b, "Diff between the defined state in Git at commit %s and actual state in cluster:\n\n", commit) b.WriteString("--- Actual (LiveState)\n+++ Expected (Git)\n\n") details := diffResult.Render(provider.DiffRenderOptions{ diff --git a/pkg/app/pipedv1/plugin/kubernetes/provider/diff.go b/pkg/app/pipedv1/plugin/kubernetes/provider/diff.go index ce15952bb7..945ac9de21 100644 --- a/pkg/app/pipedv1/plugin/kubernetes/provider/diff.go +++ b/pkg/app/pipedv1/plugin/kubernetes/provider/diff.go @@ -193,11 +193,11 @@ func (r *DiffListResult) Render(opt DiffRenderOptions) string { index := 0 for _, delete := range r.Deletes { index++ - b.WriteString(fmt.Sprintf("- %d. %s\n\n", index, delete.Key().ReadableString())) + fmt.Fprintf(&b, "- %d. %s\n\n", index, delete.Key().ReadableString()) } for _, add := range r.Adds { index++ - b.WriteString(fmt.Sprintf("+ %d. %s\n\n", index, add.Key().ReadableString())) + fmt.Fprintf(&b, "+ %d. %s\n\n", index, add.Key().ReadableString()) } maxPrintDiffs := len(r.Changes) @@ -221,7 +221,7 @@ func (r *DiffListResult) Render(opt DiffRenderOptions) string { renderer := diff.NewRenderer(opts...) index++ - b.WriteString(fmt.Sprintf("# %d. %s\n\n", index, change.Old.Key().ReadableString())) + fmt.Fprintf(&b, "# %d. %s\n\n", index, change.Old.Key().ReadableString()) // Use our diff check in one of the following cases: // - not explicit set useDiffCommand option. @@ -232,7 +232,7 @@ func (r *DiffListResult) Render(opt DiffRenderOptions) string { // TODO: Find a way to mask values in case of using unix `diff` command. d, err := diffByCommand(diffCommand, change.Old, change.New) if err != nil { - b.WriteString(fmt.Sprintf("An error occurred while rendering diff (%v)", err)) + fmt.Fprintf(&b, "An error occurred while rendering diff (%v)", err) } else { b.Write(d) } @@ -241,7 +241,7 @@ func (r *DiffListResult) Render(opt DiffRenderOptions) string { } if maxPrintDiffs < len(r.Changes) { - b.WriteString(fmt.Sprintf("... (omitted %d other changed manifests)\n", len(r.Changes)-maxPrintDiffs)) + fmt.Fprintf(&b, "... (omitted %d other changed manifests)\n", len(r.Changes)-maxPrintDiffs) } return b.String() diff --git a/pkg/app/pipedv1/plugin/kubernetes_multicluster/go.mod b/pkg/app/pipedv1/plugin/kubernetes_multicluster/go.mod index d7d31a90da..b5e9a63f2a 100644 --- a/pkg/app/pipedv1/plugin/kubernetes_multicluster/go.mod +++ b/pkg/app/pipedv1/plugin/kubernetes_multicluster/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/kubernetes_multicluster -go 1.25.0 +go 1.26.2 require ( github.com/creasty/defaults v1.6.0 diff --git a/pkg/app/pipedv1/plugin/kubernetes_multicluster/livestate/plugin.go b/pkg/app/pipedv1/plugin/kubernetes_multicluster/livestate/plugin.go index 7a97a5ec2f..e32abcf0fe 100644 --- a/pkg/app/pipedv1/plugin/kubernetes_multicluster/livestate/plugin.go +++ b/pkg/app/pipedv1/plugin/kubernetes_multicluster/livestate/plugin.go @@ -264,7 +264,7 @@ func calculateSyncState(diffResult *provider.DiffListResult, commit string, dt * } var b strings.Builder - b.WriteString(fmt.Sprintf("Diff between the defined state in Git at commit %s and actual state in cluster: %s\n\n", commit, dt.Name)) + fmt.Fprintf(&b, "Diff between the defined state in Git at commit %s and actual state in cluster: %s\n\n", commit, dt.Name) b.WriteString("--- Actual (LiveState)\n+++ Expected (Git)\n\n") details := diffResult.Render(provider.DiffRenderOptions{ diff --git a/pkg/app/pipedv1/plugin/kubernetes_multicluster/provider/diff.go b/pkg/app/pipedv1/plugin/kubernetes_multicluster/provider/diff.go index 8f291a11d4..ddb69e1c14 100644 --- a/pkg/app/pipedv1/plugin/kubernetes_multicluster/provider/diff.go +++ b/pkg/app/pipedv1/plugin/kubernetes_multicluster/provider/diff.go @@ -184,11 +184,11 @@ func (r *DiffListResult) Render(opt DiffRenderOptions) string { index := 0 for _, delete := range r.Deletes { index++ - b.WriteString(fmt.Sprintf("- %d. %s\n\n", index, delete.Key().ReadableString())) + fmt.Fprintf(&b, "- %d. %s\n\n", index, delete.Key().ReadableString()) } for _, add := range r.Adds { index++ - b.WriteString(fmt.Sprintf("+ %d. %s\n\n", index, add.Key().ReadableString())) + fmt.Fprintf(&b, "+ %d. %s\n\n", index, add.Key().ReadableString()) } maxPrintDiffs := len(r.Changes) @@ -210,14 +210,14 @@ func (r *DiffListResult) Render(opt DiffRenderOptions) string { renderer := diff.NewRenderer(opts...) index++ - b.WriteString(fmt.Sprintf("# %d. %s\n\n", index, key.ReadableString())) + fmt.Fprintf(&b, "# %d. %s\n\n", index, key.ReadableString()) b.WriteString(renderer.Render(change.Diff.Nodes())) b.WriteString("\n") } if maxPrintDiffs < len(r.Changes) { - b.WriteString(fmt.Sprintf("... (omitted %d other changed manifests)\n", len(r.Changes)-maxPrintDiffs)) + fmt.Fprintf(&b, "... (omitted %d other changed manifests)\n", len(r.Changes)-maxPrintDiffs) } return b.String() diff --git a/pkg/app/pipedv1/plugin/scriptrun/go.mod b/pkg/app/pipedv1/plugin/scriptrun/go.mod index ef45c47076..fd8b1edbcc 100644 --- a/pkg/app/pipedv1/plugin/scriptrun/go.mod +++ b/pkg/app/pipedv1/plugin/scriptrun/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/scriptrun -go 1.25.0 +go 1.26.2 require ( github.com/creasty/defaults v1.6.0 diff --git a/pkg/app/pipedv1/plugin/terraform/go.mod b/pkg/app/pipedv1/plugin/terraform/go.mod index 8947161151..d77ed001f0 100644 --- a/pkg/app/pipedv1/plugin/terraform/go.mod +++ b/pkg/app/pipedv1/plugin/terraform/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/terraform -go 1.25.0 +go 1.26.2 require ( github.com/creasty/defaults v1.6.0 diff --git a/pkg/app/pipedv1/plugin/terraform/livestate/plugin.go b/pkg/app/pipedv1/plugin/terraform/livestate/plugin.go index 52afc6780f..c7ae33426d 100644 --- a/pkg/app/pipedv1/plugin/terraform/livestate/plugin.go +++ b/pkg/app/pipedv1/plugin/terraform/livestate/plugin.go @@ -82,7 +82,7 @@ func makeSyncState(r provider.PlanResult, commit string) (sdk.ApplicationSyncSta } var b strings.Builder - b.WriteString(fmt.Sprintf("Diff between the defined state in Git at commit %s and actual live state:\n\n", commit)) + fmt.Fprintf(&b, "Diff between the defined state in Git at commit %s and actual live state:\n\n", commit) b.WriteString("--- Actual (LiveState)\n+++ Expected (Git)\n\n") details, err := r.Render() diff --git a/pkg/app/pipedv1/plugin/terraform/provider/terraform.go b/pkg/app/pipedv1/plugin/terraform/provider/terraform.go index 960ec396e6..86649d07a8 100644 --- a/pkg/app/pipedv1/plugin/terraform/provider/terraform.go +++ b/pkg/app/pipedv1/plugin/terraform/provider/terraform.go @@ -116,10 +116,10 @@ func (t *Terraform) version(ctx context.Context) (string, error) { } func (t *Terraform) init(ctx context.Context, w io.Writer) error { - args := []string{ - "init", - } - args = append(args, t.makeCommonCommandArgs()...) + commonArgs := t.makeCommonCommandArgs() + args := make([]string, 0, 1+len(commonArgs)+len(t.options.initFlags)) + args = append(args, "init") + args = append(args, commonArgs...) args = append(args, t.options.initFlags...) cmd := exec.CommandContext(ctx, t.execPath, args...) @@ -274,12 +274,10 @@ func GetExitCode(err error) int { } func (t *Terraform) Plan(ctx context.Context, w io.Writer) (PlanResult, error) { - args := []string{ - "plan", - "-lock=false", - "-detailed-exitcode", - } - args = append(args, t.makeCommonCommandArgs()...) + commonArgs := t.makeCommonCommandArgs() + args := make([]string, 0, 3+len(commonArgs)+len(t.options.planFlags)) + args = append(args, "plan", "-lock=false", "-detailed-exitcode") + args = append(args, commonArgs...) args = append(args, t.options.planFlags...) var buf bytes.Buffer @@ -390,12 +388,10 @@ func parsePlanResult(out string, ansiIncluded bool) (PlanResult, error) { } func (t *Terraform) Apply(ctx context.Context, w io.Writer) error { - args := []string{ - "apply", - "-auto-approve", - "-input=false", - } - args = append(args, t.makeCommonCommandArgs()...) + commonArgs := t.makeCommonCommandArgs() + args := make([]string, 0, 3+len(commonArgs)+len(t.options.applyFlags)) + args = append(args, "apply", "-auto-approve", "-input=false") + args = append(args, commonArgs...) args = append(args, t.options.applyFlags...) cmd := exec.CommandContext(ctx, t.execPath, args...) diff --git a/pkg/app/pipedv1/plugin/wait/go.mod b/pkg/app/pipedv1/plugin/wait/go.mod index b60a1155ea..abfdf1b5ec 100644 --- a/pkg/app/pipedv1/plugin/wait/go.mod +++ b/pkg/app/pipedv1/plugin/wait/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/wait -go 1.25.0 +go 1.26.2 require ( github.com/creasty/defaults v1.6.0 diff --git a/pkg/app/pipedv1/plugin/waitapproval/go.mod b/pkg/app/pipedv1/plugin/waitapproval/go.mod index 2bf2d6114e..fe4a74777b 100644 --- a/pkg/app/pipedv1/plugin/waitapproval/go.mod +++ b/pkg/app/pipedv1/plugin/waitapproval/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/waitapproval -go 1.25.0 +go 1.26.2 require ( github.com/creasty/defaults v1.6.0 diff --git a/pkg/app/pipedv1/trigger/trigger.go b/pkg/app/pipedv1/trigger/trigger.go index 0057394459..318b494fa7 100644 --- a/pkg/app/pipedv1/trigger/trigger.go +++ b/pkg/app/pipedv1/trigger/trigger.go @@ -412,7 +412,7 @@ func (t *Trigger) listCommandCandidates() []candidate { func (t *Trigger) listOutOfSyncCandidates() []candidate { var ( list = t.applicationLister.List() - apps = make([]candidate, 0) + apps = make([]candidate, 0, len(list)) ) for _, app := range list { if !app.IsOutOfSync() { @@ -432,7 +432,7 @@ func (t *Trigger) listOutOfSyncCandidates() []candidate { func (t *Trigger) listCommitCandidates() []candidate { var ( list = t.applicationLister.List() - apps = make([]candidate, 0) + apps = make([]candidate, 0, len(list)) ) for _, app := range list { apps = append(apps, candidate{ diff --git a/pkg/config/piped.go b/pkg/config/piped.go index 8219c58047..820c40db63 100644 --- a/pkg/config/piped.go +++ b/pkg/config/piped.go @@ -67,6 +67,7 @@ type PipedSpec struct { // List of helm chart registries that should be logged in while starting up. ChartRegistries []HelmChartRegistry `json:"chartRegistries,omitempty"` // List of cloud providers can be used by this piped. + // // Deprecated: use PlatformProvider instead. CloudProviders []PipedPlatformProvider `json:"cloudProviders,omitempty"` // List of platform providers can be used by this piped. diff --git a/pkg/crypto/aes.go b/pkg/crypto/aes.go index a5c19300b5..ea9aff92ec 100644 --- a/pkg/crypto/aes.go +++ b/pkg/crypto/aes.go @@ -54,14 +54,17 @@ func (a *AESEncryptDecrypter) Encrypt(text string) (string, error) { return "", err } - nonce := make([]byte, gcm.NonceSize()) + nonceSize := gcm.NonceSize() + nonce := make([]byte, nonceSize) _, err = rand.Read(nonce) if err != nil { return "", err } - encrypted := gcm.Seal(nil, nonce, []byte(text), nil) - encrypted = append(nonce, encrypted...) + ciphertext := gcm.Seal(nil, nonce, []byte(text), nil) + encrypted := make([]byte, 0, nonceSize+len(ciphertext)) + encrypted = append(encrypted, nonce...) + encrypted = append(encrypted, ciphertext...) return base64.StdEncoding.EncodeToString(encrypted), nil } diff --git a/pkg/diff/diff.go b/pkg/diff/diff.go index 0542ef655d..54bb4f9687 100644 --- a/pkg/diff/diff.go +++ b/pkg/diff/diff.go @@ -401,7 +401,7 @@ func convertToBoolean(v reflect.Value) (reflect.Value, bool) { } func newSlicePath(path []PathStep, index int) []PathStep { - next := make([]PathStep, len(path)) + next := make([]PathStep, len(path), len(path)+1) copy(next, path) next = append(next, PathStep{ Type: SliceIndexPathStep, @@ -411,7 +411,7 @@ func newSlicePath(path []PathStep, index int) []PathStep { } func newMapPath(path []PathStep, index string) []PathStep { - next := make([]PathStep, len(path)) + next := make([]PathStep, len(path), len(path)+1) copy(next, path) next = append(next, PathStep{ Type: MapIndexPathStep, diff --git a/pkg/diff/renderer.go b/pkg/diff/renderer.go index b9c077d48f..dc6f99148e 100644 --- a/pkg/diff/renderer.go +++ b/pkg/diff/renderer.go @@ -76,28 +76,28 @@ func (r *Renderer) Render(ns Nodes) string { switch { case lastStep.Type == SliceIndexPathStep: - b.WriteString(fmt.Sprintf("%s%*s- ", mark, depth*2-1, "")) + fmt.Fprintf(&b, "%s%*s- ", mark, depth*2-1, "") case nl: - b.WriteString(fmt.Sprintf("%s%*s%s:\n", mark, depth*2-1, "", lastStep.String())) + fmt.Fprintf(&b, "%s%*s%s:\n", mark, depth*2-1, "", lastStep.String()) default: - b.WriteString(fmt.Sprintf("%s%*s%s: ", mark, depth*2-1, "", lastStep.String())) + fmt.Fprintf(&b, "%s%*s%s: ", mark, depth*2-1, "", lastStep.String()) } parts := strings.Split(nodeString, "\n") for i, p := range parts { if lastStep.Type != SliceIndexPathStep { if nl { - b.WriteString(fmt.Sprintf("%s%*s%s\n", mark, depth*2+1, "", p)) + fmt.Fprintf(&b, "%s%*s%s\n", mark, depth*2+1, "", p) } else { - b.WriteString(fmt.Sprintf("%s\n", p)) + fmt.Fprintf(&b, "%s\n", p) } continue } if i == 0 { - b.WriteString(fmt.Sprintf("%s\n", p)) + fmt.Fprintf(&b, "%s\n", p) continue } - b.WriteString(fmt.Sprintf("%s%*s%s\n", mark, depth*2+1, "", p)) + fmt.Fprintf(&b, "%s%*s%s\n", mark, depth*2+1, "", p) } } @@ -109,16 +109,16 @@ func (r *Renderer) Render(ns Nodes) string { var array bool for i := duplicateDepth; i < pathLen-1; i++ { if n.Path[i].Type == SliceIndexPathStep { - b.WriteString(fmt.Sprintf("%*s-", (r.leftPadding+i)*2, "")) + fmt.Fprintf(&b, "%*s-", (r.leftPadding+i)*2, "") array = true continue } if array { - b.WriteString(fmt.Sprintf(" %s:\n", n.Path[i].String())) + fmt.Fprintf(&b, " %s:\n", n.Path[i].String()) array = false continue } - b.WriteString(fmt.Sprintf("%*s%s:\n", (r.leftPadding+i)*2, "", n.Path[i].String())) + fmt.Fprintf(&b, "%*s%s:\n", (r.leftPadding+i)*2, "", n.Path[i].String()) } if array { b.WriteString("\n") @@ -131,7 +131,7 @@ func (r *Renderer) Render(ns Nodes) string { valueY = reflect.ValueOf(maskString) } - b.WriteString(fmt.Sprintf("%*s#%s\n", (r.leftPadding+pathLen-1)*2, "", n.PathString)) + fmt.Fprintf(&b, "%*s#%s\n", (r.leftPadding+pathLen-1)*2, "", n.PathString) printValue("-", valueX, lastStep, r.leftPadding+pathLen-1) printValue("+", valueY, lastStep, r.leftPadding+pathLen-1) b.WriteString("\n") diff --git a/pkg/model/event.go b/pkg/model/event.go index 8ca2af2a2f..268706206c 100644 --- a/pkg/model/event.go +++ b/pkg/model/event.go @@ -65,7 +65,7 @@ func MakeEventKey(name string, labels map[string]string) string { } sort.Strings(keys) for _, key := range keys { - b.WriteString(fmt.Sprintf("/%s:%s", key, labels[key])) + fmt.Fprintf(&b, "/%s:%s", key, labels[key]) } // Make a hash to be fixed length regardless of the length of the event key. diff --git a/pkg/plugin/sdk/client.go b/pkg/plugin/sdk/client.go index 450ce32b18..c8f207ab83 100644 --- a/pkg/plugin/sdk/client.go +++ b/pkg/plugin/sdk/client.go @@ -247,6 +247,7 @@ func (c *Client) StageLogPersister() (StageLogPersister, error) { // Use this to persist the stage logs and make it viewable on the UI. // This method should be called only when the client is working with a specific stage, for example, when this client is passed as the ExecuteStage method's argument. // Otherwise, it will return nil. +// // Deprecated: use StageLogPersister instead. func (c *Client) LogPersister() StageLogPersister { return c.stageLogPersister diff --git a/pkg/plugin/sdk/diff/diff.go b/pkg/plugin/sdk/diff/diff.go index 1f373e0620..cfb82f2523 100644 --- a/pkg/plugin/sdk/diff/diff.go +++ b/pkg/plugin/sdk/diff/diff.go @@ -366,7 +366,7 @@ func convertToBoolean(v reflect.Value) (reflect.Value, bool) { } func newSlicePath(path []PathStep, index int) []PathStep { - next := make([]PathStep, len(path)) + next := make([]PathStep, len(path), len(path)+1) copy(next, path) next = append(next, PathStep{ Type: SliceIndexPathStep, @@ -376,7 +376,7 @@ func newSlicePath(path []PathStep, index int) []PathStep { } func newMapPath(path []PathStep, index string) []PathStep { - next := make([]PathStep, len(path)) + next := make([]PathStep, len(path), len(path)+1) copy(next, path) next = append(next, PathStep{ Type: MapIndexPathStep, diff --git a/pkg/plugin/sdk/diff/renderer.go b/pkg/plugin/sdk/diff/renderer.go index a5655aacea..14150f5e2f 100644 --- a/pkg/plugin/sdk/diff/renderer.go +++ b/pkg/plugin/sdk/diff/renderer.go @@ -71,28 +71,28 @@ func (r *Renderer) Render(ns Nodes) string { switch { case lastStep.Type == SliceIndexPathStep: - b.WriteString(fmt.Sprintf("%s%*s- ", mark, depth*2-1, "")) + fmt.Fprintf(&b, "%s%*s- ", mark, depth*2-1, "") case nl: - b.WriteString(fmt.Sprintf("%s%*s%s:\n", mark, depth*2-1, "", lastStep.String())) + fmt.Fprintf(&b, "%s%*s%s:\n", mark, depth*2-1, "", lastStep.String()) default: - b.WriteString(fmt.Sprintf("%s%*s%s: ", mark, depth*2-1, "", lastStep.String())) + fmt.Fprintf(&b, "%s%*s%s: ", mark, depth*2-1, "", lastStep.String()) } parts := strings.Split(nodeString, "\n") for i, p := range parts { if lastStep.Type != SliceIndexPathStep { if nl { - b.WriteString(fmt.Sprintf("%s%*s%s\n", mark, depth*2+1, "", p)) + fmt.Fprintf(&b, "%s%*s%s\n", mark, depth*2+1, "", p) } else { - b.WriteString(fmt.Sprintf("%s\n", p)) + fmt.Fprintf(&b, "%s\n", p) } continue } if i == 0 { - b.WriteString(fmt.Sprintf("%s\n", p)) + fmt.Fprintf(&b, "%s\n", p) continue } - b.WriteString(fmt.Sprintf("%s%*s%s\n", mark, depth*2+1, "", p)) + fmt.Fprintf(&b, "%s%*s%s\n", mark, depth*2+1, "", p) } } @@ -104,16 +104,16 @@ func (r *Renderer) Render(ns Nodes) string { var array bool for i := duplicateDepth; i < pathLen-1; i++ { if n.Path[i].Type == SliceIndexPathStep { - b.WriteString(fmt.Sprintf("%*s-", (r.leftPadding+i)*2, "")) + fmt.Fprintf(&b, "%*s-", (r.leftPadding+i)*2, "") array = true continue } if array { - b.WriteString(fmt.Sprintf(" %s:\n", n.Path[i].String())) + fmt.Fprintf(&b, " %s:\n", n.Path[i].String()) array = false continue } - b.WriteString(fmt.Sprintf("%*s%s:\n", (r.leftPadding+i)*2, "", n.Path[i].String())) + fmt.Fprintf(&b, "%*s%s:\n", (r.leftPadding+i)*2, "", n.Path[i].String()) } if array { b.WriteString("\n") @@ -126,7 +126,7 @@ func (r *Renderer) Render(ns Nodes) string { valueY = reflect.ValueOf(maskString) } - b.WriteString(fmt.Sprintf("%*s#%s\n", (r.leftPadding+pathLen-1)*2, "", n.PathString)) + fmt.Fprintf(&b, "%*s#%s\n", (r.leftPadding+pathLen-1)*2, "", n.PathString) printValue("-", valueX, lastStep, r.leftPadding+pathLen-1) printValue("+", valueY, lastStep, r.leftPadding+pathLen-1) b.WriteString("\n") diff --git a/pkg/plugin/sdk/go.mod b/pkg/plugin/sdk/go.mod index 64972cc162..d7847f3c03 100644 --- a/pkg/plugin/sdk/go.mod +++ b/pkg/plugin/sdk/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/piped-plugin-sdk-go -go 1.25.0 +go 1.26.2 require ( github.com/pipe-cd/pipecd v0.54.0-rc1.0.20250912082650-0b949bb7aac9 diff --git a/tool/actions-gh-release/Dockerfile b/tool/actions-gh-release/Dockerfile index e490f31521..31a64239f2 100644 --- a/tool/actions-gh-release/Dockerfile +++ b/tool/actions-gh-release/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.25.2-alpine3.22 +FROM golang:1.26.2-alpine3.22 RUN apk update && apk add git diff --git a/tool/actions-gh-release/comment.go b/tool/actions-gh-release/comment.go index f094c410b5..46a4b0318d 100644 --- a/tool/actions-gh-release/comment.go +++ b/tool/actions-gh-release/comment.go @@ -43,7 +43,7 @@ func makeCommentBody(proposals []ReleaseProposal, exists []ReleaseProposal) stri return b.String() } - b.WriteString(fmt.Sprintf("The following %d GitHub releases will be created once this pull request got merged.\n", len(proposals))) + fmt.Fprintf(&b, "The following %d GitHub releases will be created once this pull request got merged.\n", len(proposals)) for _, p := range proposals { fmt.Fprintf(&b, "\n") fmt.Fprint(&b, p.ReleaseNote) diff --git a/tool/actions-gh-release/go.mod b/tool/actions-gh-release/go.mod index 55b4ec53c2..5f2bedbe0e 100644 --- a/tool/actions-gh-release/go.mod +++ b/tool/actions-gh-release/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/actions-gh-release -go 1.25.0 +go 1.26.2 require ( github.com/creasty/defaults v1.5.2 diff --git a/tool/actions-gh-release/release.go b/tool/actions-gh-release/release.go index 6a2ab8639e..451ec561a8 100644 --- a/tool/actions-gh-release/release.go +++ b/tool/actions-gh-release/release.go @@ -345,7 +345,7 @@ func determineCommitCategory(commit Commit, mergeCommit *Commit, categories []Re func renderReleaseNote(p ReleaseProposal, cfg ReleaseConfig) []byte { var b strings.Builder - b.WriteString(fmt.Sprintf("## Release %s with changes since %s\n\n", p.Tag, p.PreTag)) + fmt.Fprintf(&b, "## Release %s with changes since %s\n\n", p.Tag, p.PreTag) gen := cfg.ReleaseNoteGenerator renderCommit := func(c ReleaseCommit) { @@ -363,23 +363,23 @@ func renderReleaseNote(p ReleaseProposal, cfg ReleaseConfig) []byte { } } } - b.WriteString(fmt.Sprintf("* %s", c.ReleaseNote)) + fmt.Fprintf(&b, "* %s", c.ReleaseNote) // If using a merge commit, prepares another options to add extra info. if gen.UsePullRequestMetadata && c.PullRequestNumber != 0 { - b.WriteString(fmt.Sprintf(" ([#%d](https://github.com/%s/%s/pull/%d))", c.PullRequestNumber, p.Owner, p.Repo, c.PullRequestNumber)) + fmt.Fprintf(&b, " ([#%d](https://github.com/%s/%s/pull/%d))", c.PullRequestNumber, p.Owner, p.Repo, c.PullRequestNumber) if !gen.UseReleaseNoteBlock && c.PullRequestOwner != "" { - b.WriteString(fmt.Sprintf(" - by @%s", c.PullRequestOwner)) + fmt.Fprintf(&b, " - by @%s", c.PullRequestOwner) } b.WriteString("\n") return } if gen.ShowAbbrevHash { - b.WriteString(fmt.Sprintf(" [%s](https://github.com/%s/%s/commit/%s)", c.AbbreviatedHash, p.Owner, p.Repo, c.Hash)) + fmt.Fprintf(&b, " [%s](https://github.com/%s/%s/commit/%s)", c.AbbreviatedHash, p.Owner, p.Repo, c.Hash) } if gen.ShowCommitter != nil && *gen.ShowCommitter { - b.WriteString(fmt.Sprintf(" - by %s", c.Committer)) + fmt.Fprintf(&b, " - by %s", c.Committer) } b.WriteString("\n") } @@ -435,7 +435,7 @@ func renderReleaseNote(p ReleaseProposal, cfg ReleaseConfig) []byte { if len(commits) == 0 { continue } - b.WriteString(fmt.Sprintf("### %s\n\n", ctg.Title)) + fmt.Fprintf(&b, "### %s\n\n", ctg.Title) for _, c := range commits { renderCommit(c) } diff --git a/tool/actions-plan-preview/Dockerfile b/tool/actions-plan-preview/Dockerfile index df6a7d7c97..756518d0de 100644 --- a/tool/actions-plan-preview/Dockerfile +++ b/tool/actions-plan-preview/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.25.0-alpine3.22 AS builder +FROM golang:1.26.2-alpine3.22 AS builder WORKDIR /app COPY go.mod go.sum ./ RUN go mod download diff --git a/tool/actions-plan-preview/go.mod b/tool/actions-plan-preview/go.mod index 293e545edb..c22d05bff5 100644 --- a/tool/actions-plan-preview/go.mod +++ b/tool/actions-plan-preview/go.mod @@ -1,6 +1,6 @@ module github.com/pipe-cd/actions-plan-preview -go 1.25.0 +go 1.26.2 require ( github.com/google/go-github/v36 v36.0.0 diff --git a/tool/actions-plan-preview/planpreview.go b/tool/actions-plan-preview/planpreview.go index dcffd90f81..958d6bb69d 100644 --- a/tool/actions-plan-preview/planpreview.go +++ b/tool/actions-plan-preview/planpreview.go @@ -188,11 +188,11 @@ func makeCommentBody(event *githubEvent, r *PlanPreviewResult, title string) str b.WriteString("\n\n") if title != "" { - b.WriteString(fmt.Sprintf("# %s\n\n", title)) + fmt.Fprintf(&b, "# %s\n\n", title) } if event.IsComment { - b.WriteString(fmt.Sprintf("@%s ", event.SenderLogin)) + fmt.Fprintf(&b, "@%s ", event.SenderLogin) } if r.NoChange() { @@ -200,7 +200,7 @@ func makeCommentBody(event *githubEvent, r *PlanPreviewResult, title string) str return b.String() } - b.WriteString(fmt.Sprintf(hasChangeTitleFormat, event.HeadCommit, len(r.Applications))) + fmt.Fprintf(&b, hasChangeTitleFormat, event.HeadCommit, len(r.Applications)) changedApps, pipelineApps, quickSyncApps := groupApplicationResults(r.Applications) if len(changedApps)+len(pipelineApps)+len(quickSyncApps) > 0 { diff --git a/tool/codegen/Dockerfile b/tool/codegen/Dockerfile index 5a9c1290c2..587cd68cba 100644 --- a/tool/codegen/Dockerfile +++ b/tool/codegen/Dockerfile @@ -1,6 +1,6 @@ # Stage 1: Builder - Build Go-based plugins -FROM golang:1.25.2 AS builder +FROM golang:1.26.2 AS builder # Version configuration ARG PROTOC_GEN_GO_VER=1.27.1 @@ -75,7 +75,7 @@ RUN apt-get update \ # Copy Go runtime from golang image # mockgen uses 'go list' and 'go build' internally -COPY --from=golang:1.25.2 /usr/local/go /usr/local/go +COPY --from=golang:1.26.2 /usr/local/go /usr/local/go ENV GOROOT=/usr/local/go ENV GOPATH=/go ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH diff --git a/tool/codegen/protoc-gen-auth/go.mod b/tool/codegen/protoc-gen-auth/go.mod index 1b4caacfa3..1abbf51f6b 100644 --- a/tool/codegen/protoc-gen-auth/go.mod +++ b/tool/codegen/protoc-gen-auth/go.mod @@ -1,5 +1,5 @@ module github.com/pipe-cd/pipecd/tool/codegen/protoc-gen-auth -go 1.25.0 +go 1.26.2 require google.golang.org/protobuf v1.33.0