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: Inconsistent indentation in struct literal with long field names #17705
Labels
Comments
This is a feature. |
It's a misfeature when it causes this kind of diff: fchan, err := scanner.Walk(scanner.Config{
- Folder: folderCfg.ID,
- Dir: folderCfg.Path(),
- Subs: subDirs,
- Matcher: ignores,
- BlockSize: protocol.BlockSize,
- TempNamer: defTempNamer,
- TempLifetime: time.Duration(m.cfg.Options().KeepTemporariesH) * time.Hour,
- CurrentFiler: cFiler{m, folder},
- Lstater: mtimefs,
- IgnorePerms: folderCfg.IgnorePerms,
- AutoNormalize: folderCfg.AutoNormalize,
- Hashers: m.numHashers(folder),
- ShortID: m.shortID,
+ Folder: folderCfg.ID,
+ Dir: folderCfg.Path(),
+ Subs: subDirs,
+ Matcher: ignores,
+ BlockSize: protocol.BlockSize,
+ TempNamer: defTempNamer,
+ TempLifetime: time.Duration(m.cfg.Options().KeepTemporariesH) * time.Hour,
+ CurrentFiler: cFiler{m, folder},
+ Lstater: mtimefs,
+ IgnorePerms: folderCfg.IgnorePerms,
+ AutoNormalize: folderCfg.AutoNormalize,
+ Hashers: m.numHashers(folder),
+ ID: m.id,
ProgressTickIntervalS: folderCfg.ScanProgressIntervalS,
Cancel: cancel,
}) |
In any case, it's intentional. Code formatters often generates diffs of unrelated code. C'est la vie. |
See also #16170 for an explanation (you need to read among the comments. The ratio between different entries matters). |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Go 1.7.3.
https://play.golang.org/p/R2C1ULJxFq
When the difference in length between two sucessive struct fields exceeds 15 characters, indentation is restarted. Is this intentional? That is, this declaration:
which looks fine, becomes this when the
ShortID
field is removed:This is unexpected to me, I would expect the
42
to remain aligned with the10
.The text was updated successfully, but these errors were encountered: