-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
gci and goimports --fix wrongly removing packages #2161
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
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
I'm facing the same issue with |
Runs `golangci-lint run --fix` to re-order package imports. Fix is wrongly removing some packages so they had to be manually fixed. Link: golangci/golangci-lint#2161
Runs `golangci-lint run --fix` to re-order package imports. Fix is wrongly removing some packages so they had to be manually fixed. Link: golangci/golangci-lint#2161
Runs `golangci-lint run --fix` to re-order package imports. Fix is wrongly removing some packages so they had to be manually fixed. Link: golangci/golangci-lint#2161
Runs `golangci-lint run --fix` to re-order package imports. Fix is wrongly removing some packages so they had to be manually fixed. Link: golangci/golangci-lint#2161
Runs `golangci-lint run --fix` to re-order package imports. Fix is wrongly removing some packages so they had to be manually fixed. Link: golangci/golangci-lint#2161
We're also hitting an issue where Edit: In our case, the
|
For me, my imports looked like this:
The two imports from myOrg were getting deleted. Writing it in this order alleviate my problem:
I have some linter configured (don't know which) that specifies that these imports should be below stdlib imports. That's probably where the confusion is happening for the linter. It is doing the removal from the wrong area but not the insertion into the right area. |
Welcome
Description of the problem
When I have enabled GCI and goimports and run with
--fix
certain packages are being removed.Now if I run
gci
andgoimports
manually, the commands fix the issues and does not remove the packages, later on runninggolangci-lint run --fix
nothing happens.Packages being removed for the provided example:
Running with
--fix -v
:Version of golangci-lint
Configuration file
Go environment
Verbose output of running
Code example or link to a public repository
service.go:
EDIT
pkg/logger/logger.go
pkg/logs/logs.go
pkg/service/service.go
.golangci.yml
The text was updated successfully, but these errors were encountered: