Comments (3)
I'm sorry but no - gofmt works across teams and projects because it's not configurable. gofumpt follows the same principle.
If there is a particular rule that's buggy or that's too controversial, it should be changed or removed. Otherwise there are no plans to add any configuration options.
from gofumpt.
I agree that no rules of the gofmt shoud be optional, cause gofmt is a standart tool, provided by the developers of the golang.
Still the gofumpt is not a part of the golang and there is a reason why the added rules are still not a part of the gofmt. I think the reason is not the developers are "too lazy" to add them. Probably some formatting rules should not be forced.
Personaly I have come concerns about the following rules, which are quite sane, but could reduce redability in specific cases:
"Composite literals should use newlines consistently"
"Short case clauses should take a single line"
"Octal integer literals should use the 0o prefix on modules using Go 1.13 and later"
Even the go library code still uses the "0" prefix - not "0o" in their code.
Example: https://cs.opensource.google/go/go/+/refs/tags/go1.21.6:src/os/tempfile.go;l=94
The spec says nothing about "0o" is preferred over "0" prefix https://go.dev/ref/spec
Most developers are used to the form of 0644, 0755, 0777 and the "0o644" looks wired and confusing to me. Still I understand that some developers may be used to the form of "0o". I agree that the form of octal prefix could be the same across project, still this form should be an option.
Anyway thanks for the answer about your plan for the library.
from gofumpt.
The 0o
prefix is more consistent with other prefixes like 0b
. There's nothing wrong with the old format, and the spec of course doesn't say which one is "better", but the entire point of gofumpt is to enforce some amount of consistency. Sometimes the formatting choices may seem arbitrary, but ultimately it's all about this consistency between developers.
from gofumpt.
Related Issues (20)
- feature: Enforce line breaks between multiline function calls with func() argument HOT 1
- add simplifications for Go 1.22 HOT 1
- panic: invalid semver string: "v1.22rc2" HOT 1
- missing binary release at latest version-v0.6.0 HOT 1
- Single import should not be grouped with parentheses
- Generated file not ignored HOT 2
- prevent indentation confusion
- Gofumpt removing newlines before comments HOT 7
- gofumpt is very slow when `go` is behind an asdf shim HOT 3
- Split long lines only available behind environment string
- Publish v1 HOT 2
- how to ignore certain folders? HOT 8
- Alias imported package to match the package name
- Group adjacent short variable declarations HOT 1
- Import grouping vs internal HOT 5
- Option to disable imports processing HOT 2
- octal notation with people misusing date.Time HOT 5
- v0.7.0 is failing with "invalid Go version: 1.22" when running via golangci linter HOT 17
- gofumpt removes multiple `tag_name:"..."` tags, only first is left
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gofumpt.