-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
doc: document changes in behavior of gofmt in 1.11 #26228
Comments
This change was done on purpose in 542ea5a. As to why gofmt changes every release - see @griesemer's comment in #25161 (comment). However, I agree that this change should be documented in the release notes. I can't see it in https://tip.golang.org/doc/go1.11. |
Oh! actually found that commit, but see I forgot to include it in my description (thanks!) hm, alright, so I understand Go should not stop progression; just thinking what the best approach is for projects that test against, and support multiple go versions;
|
Yes - if a project wants to enforce The other option is to not enforce it via CI, and instead enforce it via pre-commit checks and by humans, like Go itself does. |
True; just that, pre-commit checks won't resolve accepting contributions from users running different versions of go. In an ideal world, every project would switch to (and be compatible with) latest stable Go the moment it's released. Although upgrading Go versions has become less painful over the years, but we're not there yet, so unfortunately this isn't always possible (hence, contributors pinning to different versions of Go). Thanks for your suggestions; it's appreciated 👍 |
I agree that enforcing this server-side instead of client-side is better. Perhaps it should be made easier for developers to download specific versions of
#22695 didn't seem to reach any conclusion that would help with this. I might open a proposal issue along the lines of what I described above, once this documentation issue is fixed. |
Yes, while writing my previous comment, I wanted to suggest a "version" option, so that a different Having said the above, perhaps there's still merit in that option; introduce an option to select a "slow" version of For example, currently, Go 1.11 (next stable), 1.10.x (current stable), and 1.9.x (previous stable) are actively maintained; I think it's ok to assume (most) projects that support multiple Go versions won't Go beyond those versions Could look something like this; (
edit: removed |
When I mentioned a version flag, I meant just a flag to print its version :) Then, scripts could do something like:
I'll send a proposal about this in a few days. @thaJeztah if you want, I can email you a draft before publishing. |
Looks like that would indeed help 👍 You can /cc me at |
Change https://golang.org/cl/122295 mentions this issue: |
Yes, Russ has made this comment too in the past. Pre-commit checks don't work well in practice unless there is either a requirement that contributors run a Makefile to install the hooks or there is a bespoke codereview tool as exists for Go contributions. These are not necessarily feasible for small open source projects (a good example is Gonum where we already have difficulty managing new and drive-by contributions). I'll just go and eat my brioche. |
@kortschak please note that this issue is closed, and that I filed a proposal precisely to make enforcing gofmt easier - #26397. |
go 1.11's "go fmt" has a backwards incompatible formatting change due to golang/go#26228 which only affects the csi/csi_test.go file. This is a temporary workaround for difference in go fmt between 1.9/1.10 and 1.11+, to fix travis. We can remove this when we drop go 1.9 and go 1.10 from travis. Signed-off-by: Craig Rodrigues <[email protected]>
go 1.11's "go fmt" has a backwards incompatible formatting change due to golang/go#26228 which only affects the csi/csi_test.go file. This is a temporary workaround for difference in go fmt between 1.9/1.10 and 1.11+, to fix travis. We can remove this when we drop go 1.9 and go 1.10 from travis. Signed-off-by: Craig Rodrigues <[email protected]>
go 1.11's "go fmt" has a backwards incompatible formatting change due to golang/go#26228 which only affects the csi/csi_test.go file. This is a temporary workaround for difference in go fmt between 1.9/1.10 and 1.11+, to fix travis. We can remove this when we drop go 1.9 and go 1.10 from travis. Signed-off-by: Craig Rodrigues <[email protected]>
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.11beta1 linux/amd64
Does this issue reproduce with the latest release?
yes, latest beta
What operating system and processor architecture are you using (
go env
)?What did you do?
Running
gofmt
in Go 1.11beta1 causes a diff 😄To reproduce;
example.go
, with the following content;gofmt
the file;What did you expect to see?
On Go 1.10.3, only the first map is re-formatted (the threshold for aligning values lies at 19 characters)
What did you see instead?
On Go 1.11beta1, both maps are re-formatted (the threshold for aligning values lies at 18 characters):
This change complicates projects that test against multiple versions of Go (see related issues moby/moby#37358, containerd/containerd#2436)
If this was a deliberate change, please add a mention of this in the changelog 🤗
The text was updated successfully, but these errors were encountered: