-
Notifications
You must be signed in to change notification settings - Fork 66
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
Rework module detection for golangci-lint integration #195
Comments
@daixiang0 do you have an intuition of how easy/difficult it would be to rewrite the localmodule logic to use https://github.com/golangci/modinfo as suggested? I'd be happy to help make this great feature land on golangci-lint, but I'm not familiar with neither modinfo nor gci, so all help would be welcome |
@CarlosRDomin not hard to do it, you can add modinfo in https://github.com/daixiang0/gci/blob/master/pkg/analyzer/analyzer.go#L44, then you can get mod file obj in the https://github.com/daixiang0/gci/blob/master/pkg/analyzer/analyzer.go#L50. |
Apologies for the delay, I've been fairly busy and just had a bit of time to take a look into the issue. Based on this comment, the issue is with I don't have enough knowledge to make gci runnable inside golangci-lint without any further help. @ldez, out of curiosity, have you already tried running the latest gci through golangci-lint and you saw errors or what made you think that the current implementation wouldn't work? Do you have a failing test I could run with a debugger and try to fix? I'd love to help but really don't know how at this point :( |
I don't need to run it to know that just reading a The problem here is still the same: the design. The elements inside this comment are not helpful because the information about that module requires the gci/pkg/section/local_module.go Line 38 in 4725b0c
Lines 96 to 106 in 4725b0c
Lines 43 to 54 in 4725b0c
And so, to every call to |
After digging more into the code: it's impossible to get something to work as expected without rewriting a large part of the gci code (and not extending it). @CarlosRDomin, without deeply changing the gci design it's useless to try to fix that inside gci. At some point, if the design doesn't evolve in the right direction, either we will have all the code of gci "customized" and inside golangci-lint, or we will have to fork it, or just use another linter. When 500 LOC becomes more than 3000 LOC to provide the same thing as before, and the usage as a lib is unexpectedly complex, requires a lot of plumbing, and to borrow the code, I think it's just honest to say that there is a major design problem. |
The "fix" (a kind of copy of my hack) is in the continuity of the current design problems of gci, and fix nothing inside golangci-lint. The core of the design problem is not fixed, it should be fixed. |
@ldez does an amazing job on I'm sure a smiley would have helped. Respectfully, a fan of |
Because it is, I'm not happy with the situation, so I will not add any smiley. You are nice, but I don't need help handling this situation the way I want. |
What version of GCI are you using?
Problem
Golangci-lint cannot use latest version of the gci.
Reason described in the comment
The text was updated successfully, but these errors were encountered: