-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
format: support Go versions from newer go.mod files
The 'go' directive in go.mod files can now contain strings such as "go1.22rc1" or "go1.21.1", and our old semver logic didn't support some of those. Upstream is providing new API via go/version in Go 1.22, but until that is out, we implement our own workaround to avoid panics. Fixes #280.
- Loading branch information
Showing
4 changed files
with
48 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Test various edge cases with go.mod files. | ||
|
||
exec gofumpt toolchain-stable/a.go | ||
stdout '//gofumpt:diagnose.* -lang=v1.21' | ||
|
||
exec gofumpt toolchain-unstable/a.go | ||
stdout '//gofumpt:diagnose.* -lang=v1.21' | ||
|
||
-- toolchain-stable/go.mod -- | ||
module a | ||
|
||
go 1.21.2 | ||
-- toolchain-stable/a.go -- | ||
package a | ||
|
||
//gofumpt:diagnose | ||
|
||
-- toolchain-unstable/go.mod -- | ||
module a | ||
|
||
go 1.21rc3 | ||
-- toolchain-unstable/a.go -- | ||
package a | ||
|
||
//gofumpt:diagnose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters