Skip to content

feat: use go.mod when no version inputs specified#660

Open
raeperd wants to merge 5 commits intoactions:mainfrom
raeperd:feat-go-version-file-by-default
Open

feat: use go.mod when no version inputs specified#660
raeperd wants to merge 5 commits intoactions:mainfrom
raeperd:feat-go-version-file-by-default

Conversation

@raeperd
Copy link

@raeperd raeperd commented Oct 12, 2025

Description:

This PR adds automatic go.mod detection when neither go-version nor go-version-file is specified. This simplifies workflows for Go projects that already have a go.mod file.

Before:

steps:
  - uses: actions/checkout@v5
  - uses: actions/setup-go@v6
    with:
      go-version-file: go.mod
  - run: go version

After:

steps:
  - uses: actions/checkout@v5
  - uses: actions/setup-go@v6
    # Automatically detects and uses go.mod from repository root
  - run: go version

Related issue:
Closes #523

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

- Add unit tests for auto-detection behavior
- Implement go.mod auto-detection in resolveVersionInput()
- Explicit inputs still take precedence over auto-detection

Related issue: actions#523
@raeperd raeperd requested a review from a team as a code owner October 12, 2025 08:59
@raeperd raeperd changed the title feat: auto-detect go.mod when no version inputs specified feat: use go.mod when no version inputs specified Oct 27, 2025
Resolve merge conflicts:
- action.yml: combine auto-detect description with .go-version/.tool-versions support
- versions.yml: keep auto-detect-go-mod job alongside new tool-versions/go-version jobs
- README.md: keep auto-detect section, adopt main's link to advanced-usage docs
- tests: keep auto-detect tests alongside new go-download-base-url tests
@raeperd
Copy link
Author

raeperd commented Mar 25, 2026

Hi @aparnajyothi-y @priyagupta108,

As a user of this action, this would be a nice quality-of-life improvement — I find myself specifying go-version-file: go.mod in every workflow even though it's the most common setup.

I saw you both reviewed related changes in #705 and #673, so your feedback here would be really valuable. Happy to make any changes needed.

Thank you!

Follows the pattern from actions#724 where detailed usage docs live in
docs/advanced-usage.md rather than README.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make go-version-file: go.mod the default

1 participant