-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
playground: format go.mod files; fix paths in formatting errors
Previously, handleFmt applied gofmt/goimports formatting to .go files only. This change makes it apply formatting to go.mod files as well. The cmd/go/internal/modfile package (well, a non-internal copy thereof) is used to perform the go.mod file formatting. Add test cases for error messages, and fix some cases where the paths weren't accurate. Detect when the error was returned by format.Source and needs to be prefixed by using the fixImports variable instead of checking for the presence of the prefix. This makes the code simpler and more readable. Replace old fs.m[f] usage with fs.Data(f) in fmt.go and txtar_test.go. Updates golang/go#32040 Updates golang/go#31944 Change-Id: Iefef7337f962914817558bcf0c622a952160ac44 Reviewed-on: https://go-review.googlesource.com/c/playground/+/177421 Reviewed-by: Brad Fitzpatrick <[email protected]>
- Loading branch information
Showing
4 changed files
with
88 additions
and
26 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
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