-
Notifications
You must be signed in to change notification settings - Fork 17.4k
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
cmd/gofmt: will change some comments to a less correct format #54789
Comments
This is intended behavior; see https://tip.golang.org/doc/go1.19#go-doc and #51082. If you find a particular bug with the rewriting, I would suggest to make your bug report clearer, like #54312. You can always try to argue that this whole rewriting feature shouldn't happen at all, but then that's more of a feature reversal request than a bug report. |
That an error in source formatting (extra space), that needs to be fixed manually The rest look like gofmt working as intended. |
@seankhliao please look at The original spacing looks correct: // -v controls verbosity (0: only report coverage, 1: report as each directory is finished,
// 2: report on each test, 3: more details, 4: too much) will // -v controls verbosity (0: only report coverage, 1: report as each directory is finished,
//
// 2: report on each test, 3: more details, 4: too much)
// But this is incorrect, the I have try some option:
only option 5 and option 6 Keep my spacing from being // -v controls verbosity (0: only report coverage, 1: report as each directory is finished,
// 2: report on each test, 3: more details, 4: too much) It is also not good. So the only option available is to use /* -v controls verbosity (0: only report coverage, 1: report as each directory is finished,
2: report on each test, 3: more details, 4: too much)
*/ I would like to know if the above changes are bugs or feature? 😂 |
The original godoc was buggy: it considered the second line as a blockquote due to the spacing. The godoc needs to be manually fixed to either blockquote the whole thing, or to not use any leading spaces and keep the whole thing as a regular paragraph. The gofmt rewriting is making the bad godoc surface, so I think that's a good outcome, even if the godoc is still buggy.
Please keep it civil and respectful :) |
Apologies for my poor English and translation tools, no rudeness intended here, I added emoticons to prevent misunderstandings, but it looks like it failed 😢 Thank you for your patience and answers. |
Golang-lint 1.48+(included) uses gofmt based on go 1.9. The result of Gofmt based on go1.9 is different from Gofmt based on go1.18([different](golang/go#54789)). As a result, Golang-lint 1.48+ reports "File is not `gofmt`-ed with `-s` (gofmt)", although gofmt(1.8 based) says the code is ok. Scroll back to golang-lint 1.47.3, which uses gofmt based on go 1.8. In the future, upgrade golang-lint when go version is higher or equal to 1.9. Signed-off-by: 泰友 <cuichengxu.ccx@antgroup.com>
Golang-lint 1.48+(included) uses gofmt based on go 1.9. The result of Gofmt based on go1.9 is different from Gofmt based on go1.18([different](golang/go#54789)). As a result, Golang-lint 1.48+ reports "File is not `gofmt`-ed with `-s` (gofmt)", although gofmt(1.8 based) says the code is ok. Scroll back to golang-lint 1.47.3, which uses gofmt based on go 1.8. In the future, upgrade golang-lint when go version is higher or equal to 1.9. Signed-off-by: 泰友 <cuichengxu.ccx@antgroup.com>
Golang-lint 1.48+(included) uses gofmt based on go 1.9. The result of Gofmt based on go1.9 is different from Gofmt based on go1.18([different](golang/go#54789)). As a result, Golang-lint 1.48+ reports "File is not `gofmt`-ed with `-s` (gofmt)", although gofmt(1.8 based) says the code is ok. Scroll back to golang-lint 1.47.3, which uses gofmt based on go 1.8. In the future, upgrade golang-lint when go version is higher or equal to 1.9. Signed-off-by: 泰友 <cuichengxu.ccx@antgroup.com>
Golang-lint 1.48+(included) uses gofmt based on go 1.9. The result of Gofmt based on go1.9 is different from Gofmt based on go1.18([different](golang/go#54789)). As a result, Golang-lint 1.48+ reports "File is not `gofmt`-ed with `-s` (gofmt)", although gofmt(1.8 based) says the code is ok. Scroll back to golang-lint 1.47.3, which uses gofmt based on go 1.8. In the future, upgrade golang-lint when go version is higher or equal to 1.9. Signed-off-by: 泰友 <cuichengxu.ccx@antgroup.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Let me use a few examples of code from the https://github.com/golang/tools
example:
https://github.com/golang/tools/blob/248c34b88a4148128f89e41923498bd86f805b7d/gopls/internal/coverage/coverage.go#L15
https://github.com/golang/tools/blob/248c34b88a4148128f89e41923498bd86f805b7d/internal/lsp/diff/lcs/labels.go#L11
https://github.com/golang/tools/blob/248c34b88a4148128f89e41923498bd86f805b7d/internal/typeparams/coretype.go#L84
https://github.com/golang/tools/blob/248c34b88a4148128f89e41923498bd86f805b7d/internal/typeparams/typeterm.go#L13
1. in go1.18
gofmt
does not change these files2. in go1.19
gofmt
make some comments to a less correct formatWhat did you expect to see?
I guess there are at least some comments that should not be changed
What did you see instead?
The comments on these files have changed
The text was updated successfully, but these errors were encountered: