Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update syntax for version in Go mod file directive #3634

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

matthewhughes934
Copy link
Contributor

@matthewhughes934 matthewhughes934 commented Jan 22, 2024

Since go1.21 this directive supports the same version format as the toolchain directive[1] (though it doesn't support any suffixes). Specifically it supports formats such as:

  • 1.20 (this was supported previously)
  • 1.21.0
  • 1.21rc1

Note: patch versions do not have release candidates (e.g. 1.21.1rc2 is not valid)

[1] https://go.dev/ref/mod#go-mod-file-go

@@ -61,7 +61,7 @@ syntax match gomodToolchainVersion "go1\(.\d\+\)\{,2\}\(rc\d\+\)\?\([ \t-].*\)\?
highlight default link gomodToolchainVersion Identifier

" match go versions
syntax match gomodGoVersion "1\.\d\+" contained
syntax match gomodGoVersion "\(1.\d\+\)\(\(.\d\+\)\|\(rc\d\+\)\)\?" contained
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is clearer with magic: \v(1.\d+)((.\d+)|(rc\d+))?. I think I've seen this used elsewhere in these syntax files so maybe a worthwhile change?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm ok without the magic.

Since go1.21 this directive supports the same version format as the
`toolchain` directive[1] (though it doesn't support any suffixes).
Specifically it supports formats such as:

* `1.20` (this was supported previously)
* `1.21.0`
* `1.21rc1`

Note: patch versions do not have release candidates (e.g. `1.21.1rc2` is
not valid)

[1] https://go.dev/ref/mod#go-mod-file-go
Copy link
Collaborator

@bhcleek bhcleek left a comment

Choose a reason for hiding this comment

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

Thank you

@bhcleek bhcleek added this to the vim-go v1.29 milestone Jan 22, 2024
@bhcleek bhcleek merged commit ca6c532 into fatih:master Jan 22, 2024
8 checks passed
@matthewhughes934 matthewhughes934 deleted the support-broader-go-versions branch January 23, 2024 06:35
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.

2 participants