-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
confusing error message "File is not goimports-ed (goimports)" #138
Comments
hi! |
This way we can never improve error message 😇 |
You are right, I got an idea to mark it as |
Is this using some custom version of goimports? I recently had it complain about one import even though the file was formatted by goimports. Turned out it wanted me to move it to another group of imports (even though regular goimports doesn't move imports between groups). |
This has started to happen to me since 1.24+. Running GolangCI with goimports suggests files aren't properly formatted even though running both gofmt and goimports manually on the files golangci complains about results in no changes and both tools exiting with a status code of 0. |
Same here (but I'm a new user).
|
I just ran into this problem too. A better message would have gotten me to a fix quicker. |
+1; Human readable message is expected and "File is not goimportes-ed" confused me |
|
The message should explain what the problem is (e.g. missing an import statement for package x.) It could also maybe propose a solution like, add the import statement or |
@bcomnes, In addition to fixing imports, goimports also formats your code in the same style as gofmt |
i have the same error, but run goimports -w on file does not bring any differences. |
Is there any update on this? Maybe it makes sense to at least add documentation to this check? Right now, it reports two lines in my project and I have no idea what it means and how to resolve them ( |
I came across the same issue. It was being fixed by the following steps:
|
@samurnin, the |
Built-in and non-built-in packages should be separated and the built-in packages placed first
|
+1 for @samurnin for the details steps.
|
"File is not goimports-ed (goimports)" is a really bad message, confusing, wasting time trying to understand what it means. |
Echoing the "what? my vim config runs gofmt automatically, and it doesn't care, so why the hell does golangci?" sentiment. The error
@jirfag да блин, кто они? наверно, если эти юзери, ну «перегрузить» бы свои exclude lists, многие другие юзери улыбнулись бы 🤣 )))))) It's not immediately obvious what to do when this occurs (simply running
That offers both a command that shows the issue only, and a command that will just fix it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
it's not only about imports - #138 (comment) and #138 (comment) So it's probably the main confusion with this message when one trying to "fix" imports, but the problem is another place. |
we already had this discussion and decided that the message will be changed in v2 |
A file not being "goimports-ed" is a little confusing. Can we adjust this error message to something a little clearer like "File has not been formatted (goimports)"
The text was updated successfully, but these errors were encountered: