go-version-file does not parse .mod files other than go.mod
Maintainers usually reply within 5 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- go, typescript
- Domain
- devops
Research direction
Start at parseGoVersionFile, especially the basename check described in the issue. Update handling so any .mod path uses Go module parsing, then verify that named module files resolve their toolchain or go directive rather than treating the full file contents as the version.
Written by the indexing model from the issue text.
Description
Description
When using go-version-file with a .mod file that is not literally named go.mod (e.g., golangci-lint.mod, tools.mod), the parseGoVersionFile function fails to extract the Go version correctly.
This is because the current implementation checks path.basename(versionFilePath) === 'go.mod', which only matches files named exactly go.mod. Any other .mod file falls through to the default case, which returns the entire file contents as the version string — causing version resolution to fail.
Use Case
A common Go community pattern is to use dedicated module files for tool dependencies. For example, golangci-lint recommends using a separate golangci-lint.mod file to pin the linter version independently from the project's go.mod.
Users should be able to use these files with go-version-file to install the correct Go version:
- uses: actions/setup-go@v6
with:
go-version-file: golangci-lint.mod
Current Behavior
parseGoVersionFile only recognizes:
go.mod(exact basename match)go.work(exact basename match).tool-versions(exact basename match)
Any .mod file with a different name (e.g., golangci-lint.mod, tools.mod) is not parsed as a Go module file.
Expected Behavior
Any file ending in .mod should be parsed using the same Go module file logic (extracting toolchain or go directives), not just files named exactly go.mod.
Proposed Fix
Change the condition from:
path.basename(versionFilePath) === 'go.mod'
to:
versionFilePath.endsWith('.mod')
[!Note]
Responses generated with Claude
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 684
- Avg merge
- 12d 23h
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from actions/setup-go
-
Provide an option to skip the Go SDK tool-cache write for ephemeral / parallel self-hosted runnersOpenfeature request
Difficulty 3/5 1-2 days Newbie friendliness 72/100
actions/setup-go#792 · 4 comments ·
Maintainers usually reply within 5 days
-
feature request
Difficulty 4/5 3-5 days Newbie friendliness 45/100
actions/setup-go#757 · 2 comments ·
Maintainers usually reply within 5 days
-
feature request
Difficulty 3/5 1-2 days Newbie friendliness 55/100
actions/setup-go#749 · 2 comments ·
Maintainers usually reply within 5 days
-
feature request
Difficulty 3/5 1-2 days Newbie friendliness 58/100
actions/setup-go#746 · 8 comments ·
Maintainers usually reply within 5 days
-
feature request
Difficulty 3/5 1-2 days Newbie friendliness 42/100
actions/setup-go#720 · 1 comment ·
Maintainers usually reply within 5 days
All issues in actions/setup-go
Similar issues
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysPossibly taken @pcbeingused333 claimed this today. OpenBug db: d1-sqlite Payload OSS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19766 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
device-management-toolkit/sample-web-ui#3711 ·
Maintainers usually reply within 1 day
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
elastic/kibana#306401 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
agentes-chat/agentes-chat#927 ·
Maintainers usually reply within 1 day
-
Closing a pinned tab jumps to the Tabs section instead of the next open pinned tabPossibly taken @seenimohamed claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ardia-browser/ardia#2769 ·
Maintainers usually reply within 1 day