-
Notifications
You must be signed in to change notification settings - Fork 61
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
bug: v0.4.0 changes default ordering #71
Comments
Yes, v0.4.0 introduces breaking changes. |
If I'm understanding it correctly, you're saying that it's no longer an option to organize custom imports after default? My organization previously was:
That's my only use case, and the one use case I see consistently across other repos and orgs, and have used for years. |
Now the imports like:
The custom section is for your own org, the reason is based on how far the imports are from your repo. The "standard" is built-in, which should be first. The default section means all 3rd-party imports, should be last. |
@daixiang0 I have installed the latest golangci-lint (ed4befe), but the auto-fix result is wrong. linters-settings:
gci:
sections:
- standard
- default
- prefix(myorg) the order of
I confirmed that the prefix is working because when I commented it out, it was merged into default. |
The order is not related to your config :( Please check doc |
Is there any necessary reason for this breaking change? |
It looks like UPDATE When I install the pre-master golangci-lint The order of |
There would be a misunderstanding that I never say the section order can be configured, I will update the document to make it clear. |
@Dreamacro please try golangci/golangci-lint@5e18365 |
@daixiang0 It seems that if the prefix contains uppercase letters, the packets are not aggregated properly. BTW, It would be nice to be able to sort in the order of |
@Dreamacro let me confirm it. |
I would like to second this. This is the main reason I started using
I had been using |
Thank you @daixiang0, |
@Dreamacro not reproduce it, could you provide config and codes?
|
@daixiang0 It can be reproduced on my repo: https://github.com/Dreamacro/clash run issues:
fix: true then run |
The default section means:
So it works as your config. |
@daixiang0 Still a bit confused, is this any different from the example in https://github.com/daixiang0/gci#examples? |
I tried the example.
package main
import (
"golang.org/x/tools"
"fmt"
"github.com/daixiang0/gci"
) to package main
import (
"fmt"
"golang.org/x/tools"
"github.com/daixiang0/gci"
)
package main
import (
"golang.org/x/tools"
"fmt"
"github.com/Daixiang0/gci"
) to package main
import (
"fmt"
"github.com/Daixiang0/gci"
"golang.org/x/tools"
) |
https://github.com/daixiang0/gci/pull/70/files#r917027845
The already-good code changed from
standard, default, prefix(github.com/daixiang0/gci)
tostandard, prefix(github.com/daixiang0/gci), default
even though the sections configuration did not change: https://github.com/daixiang0/gci/blob/9349c88f1609b0e71ec5cac5576b1a413ac25869/pkg/gci/internal/testdata/common.cfg.yamlThe text was updated successfully, but these errors were encountered: