-
-
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
File is not gofumpt-ed on properly formatted code #4004
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
The go version is extracted from the I think the problem is not really related to Can you provide a fully reproducible example? Note: golangci-lint is not able to run on all modules of a workspace in one run. |
in golangci-lint config. This fixes the false positive `file is not gofumpt-ed` error although the file is correctly formatted [1]. [1]: golangci/golangci-lint#4004
I could reproduce this issue both locally and in the CI. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This is happening to us when running Windows CI only https://github.com/charmbracelet/bubbletea/actions/runs/11579099435/job/32234508362?pr=1214.
|
@aymanbagabas I think your problem doesn't have the same root cause as this issue. I think you are facing an issue related to the GitHub Action and the usage of Can you open a new issue on the GitHub Action repo: https://github.com/golangci/golangci-lint-action/issues/new/choose EDIT: charmbracelet/meta#175 |
Thank you, @ldez, for your help and quick reply. Unfortunately, we're still getting the |
@aymanbagabas can you open a dedicated discussion? https://github.com/golangci/golangci-lint/discussions/categories/q-a It will be easier for me. |
Welcome
Description of the problem
The problem has already been discussed in detail here: #2711
Golangci-lint sorts imports differently than standalone gofumpt. This is especially an issue when using vs code, where gopls (gofumpt) therefore formats the imports in a way that is invalid in CI-run of gofumpt (via golangci-lint).
When doing a:
//gofumpt:diagnose
One can see, that the
golangci-lint --fix
does not find themodpath
automatically if not explicitly set in the lint-settings in.golangci.yaml
. Because of this, it is not supported to have one common.golangci.yaml
in a workspace, but instead multiple are needed - one for each module, which is not very dry.Version of golangci-lint
Configuration
Go environment
Verbose output of running
Code example or link to a public repository
Diagnose in module without modpath in golangci-lint.yaml:
//gofumpt:diagnose version: v0.5.0 (go1.20.5) flags: -lang=v1.20 -modpath=
with modpath:
//gofumpt:diagnose version: v0.5.0 (go1.20.5) flags: -lang=v1.17 -modpath=some-module-name
vanilla gofumpt:
//gofumpt:diagnose version: v0.5.0 (go1.20.5) flags: -lang=v1.17 -modpath=some-module-name
Validation
The text was updated successfully, but these errors were encountered: