豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Allow for missing go directive in go.mod#13175

Merged
JamieMagee merged 1 commit intomainfrom
jamiemagee/go-empty-version
Sep 24, 2025
Merged

Allow for missing go directive in go.mod#13175
JamieMagee merged 1 commit intomainfrom
jamiemagee/go-empty-version

Conversation

@JamieMagee
Copy link
Copy Markdown
Member

What are you trying to accomplish?

We're seeing the following issue in some repositories

Passed `nil` into T.must
file_parser.rb:70:in 'Dependabot::GoModules::FileParser#go_version

The issue is that the go directive in go.mod files was optional before Go 1.211. So some projects which rely on vendor dependencies that have not been updated since then will not have the go directive.

The go directive sets the minimum version of Go required to use this module. Before Go 1.21, the directive was advisory only; now it is a mandatory requirement: Go toolchains refuse to use modules declaring newer Go versions.

This change makes it optional in Dependabot as well.

Anything you want to highlight for special attention from reviewers?

How will you know you've accomplished your goal?

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

Footnotes

  1. https://go.dev/doc/modules/gomod-ref#go

@JamieMagee JamieMagee requested a review from a team as a code owner September 24, 2025 21:06
@JamieMagee JamieMagee added the sorbet 🍦 Relates to Sorbet types label Sep 24, 2025
@github-actions github-actions bot added the L: go:modules Golang modules label Sep 24, 2025
We're seeing the following issue in some repositories

```
Passed `nil` into T.must
file_parser.rb:70:in 'Dependabot::GoModules::FileParser#go_version
```

The issue is that the `go` directive in `go.mod` files was optional before Go 1.21[1]. So some projects which rely on vendor dependencies that have not been updated since then will not have the `go` directive.

> The go directive sets the minimum version of Go required to use this module. Before Go 1.21, the directive was advisory only; now it is a mandatory requirement: Go toolchains refuse to use modules declaring newer Go versions.

This change makes it optional in Dependabot as well.

[1]: https://go.dev/doc/modules/gomod-ref#go
@JamieMagee JamieMagee force-pushed the jamiemagee/go-empty-version branch from 0333346 to 01e8991 Compare September 24, 2025 22:07
@JamieMagee JamieMagee merged commit 37dd001 into main Sep 24, 2025
81 checks passed
@JamieMagee JamieMagee deleted the jamiemagee/go-empty-version branch September 24, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: go:modules Golang modules sorbet 🍦 Relates to Sorbet types

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants