Skip to content

Pin shfmt and goimports version to resolve Go version conflict#5365

Merged
kadupoornima merged 3 commits intoGoogleCloudPlatform:developfrom
kadupoornima:go-vers
Mar 17, 2026
Merged

Pin shfmt and goimports version to resolve Go version conflict#5365
kadupoornima merged 3 commits intoGoogleCloudPlatform:developfrom
kadupoornima:go-vers

Conversation

@kadupoornima
Copy link
Copy Markdown
Contributor

Build was failing with error: mvdan.cc/sh/v3/cmd/shfmt@latest: mvdan.cc/sh/[email protected] requires go >= 1.25.0 (running go 1.24.6; GOTOOLCHAIN=local)

Resolution:

  • Pinned shfmt to the second-most recent version - go install mvdan.cc/sh/v3/cmd/[email protected]

  • After this change, tested the docker build locally using the below command:

    docker build -f tools/cloud-build/dependency-checks/Dockerfile.precommit .
    
  • Got the this similar error: 39.37 go: golang.org/x/tools/cmd/goimports@latest: golang.org/x/[email protected] requires go >= 1.25.0 (running go 1.24.6; GOTOOLCHAIN=local)

  • Made a similar change, pinned golang.org/x/tools/cmd/goimports version to v0.42.0.

  • Docker build successful.

  • Long term fix would be to upgrade the Go Environment to Go 1.25. This would require updating Go versions across the entire repository to ensure consistency and can be taken up as a separate effort.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses critical build failures caused by incompatible Go tool versions. It resolves these issues by explicitly pinning the versions of shfmt and goimports to older, compatible releases within both the Makefile and the Dockerfile.precommit. This ensures that the build process can successfully complete without requiring an immediate upgrade of the Go environment.

Highlights

  • shfmt version pinned: The shfmt tool's version was explicitly set to v3.12.0 to resolve a Go version conflict where shfmt@latest required Go 1.25.0, but the environment was running Go 1.24.6.
  • goimports version pinned: The goimports tool's version was explicitly set to v0.42.0 to resolve a similar Go version conflict, as goimports@latest also required Go 1.25.0.
  • Build stability: These changes collectively fix build failures in the tools/cloud-build/dependency-checks/Dockerfile.precommit environment, ensuring compatibility with the existing Go 1.24.6 setup.
Changelog
  • Makefile
    • Updated shfmt installation from @latest to @v3.12.0.
    • Updated goimports installation from @latest to @v0.42.0.
  • tools/cloud-build/dependency-checks/Dockerfile.precommit
    • Updated shfmt installation from @latest to @v3.12.0.
    • Updated goimports installation from @latest to @v0.42.0.
Activity
  • Pull request created by kadupoornima to address Go version conflicts in the build process.
  • Initial testing performed by the author confirmed the fix for shfmt and goimports version pinning.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@kadupoornima kadupoornima added release-version-updates Added to release notes under the "Version Updates" heading. release-bugfix Added to release notes under the "Bug fixes" heading. labels Mar 17, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively resolves the build failure by pinning shfmt and goimports to specific, compatible versions. This is a good immediate fix. My review includes suggestions to define these new version strings as variables in both the Makefile and the Dockerfile.precommit. This will improve maintainability by centralizing the version definitions and avoiding duplication, which is a good practice for managing dependencies.

@kadupoornima kadupoornima marked this pull request as ready for review March 17, 2026 08:56
@kadupoornima kadupoornima requested review from a team and samskillman as code owners March 17, 2026 08:56
@kadupoornima kadupoornima enabled auto-merge March 17, 2026 09:01
@kadupoornima kadupoornima merged commit d473900 into GoogleCloudPlatform:develop Mar 17, 2026
15 of 80 checks passed
@kadupoornima kadupoornima deleted the go-vers branch March 25, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-bugfix Added to release notes under the "Bug fixes" heading. release-version-updates Added to release notes under the "Version Updates" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants