-
-
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
1.44.2 gci fails after a comment in import #2601
Comments
Yes, I did try: |
$ git clone git@github.com:ubuntu/adsys.git
Cloning into 'adsys'...
remote: Enumerating objects: 13693, done.
remote: Counting objects: 100% (4760/4760), done.
remote: Compressing objects: 100% (1988/1988), done.
remote: Total 13693 (delta 2644), reused 4295 (delta 2319), pack-reused 8933
Receiving objects: 100% (13693/13693), 3.99 MiB | 5.10 MiB/s, done.
Resolving deltas: 100% (7815/7815), done.
$ cd adsys
$ gci -v
gci version 0.3
$ gci diff internal/ad/ad.go
2022/02/18 15:55:50 Loaded File: internal/ad/ad.go
--- internal/ad/ad.go
+++ internal/ad/ad.go
@@ -4,7 +4,6 @@
"bufio"
"bytes"
"context"
-
// embed gpolist python binary.
_ "embed"
"errors"
$ gci diff internal/testutils/pythoncoverage.go
2022/02/18 16:00:40 Loaded File: internal/testutils/pythoncoverage.go
--- internal/testutils/pythoncoverage.go
+++ internal/testutils/pythoncoverage.go
@@ -2,7 +2,6 @@
import (
"bufio"
-
// blank embed import for python3-mock.in.
_ "embed"
"fmt"
$ gci diff internal/ad/internal_test.go
2022/02/18 16:01:15 Loaded File: internal/ad/internal_test.go
--- internal/ad/internal_test.go
+++ internal/ad/internal_test.go
@@ -2,7 +2,6 @@
import (
"context"
-
// #nosec: G501: we are using it only for comparing directory tree content in tests.
"crypto/md5"
"flag"
|
Yes, it seems now that gci removes this empty line (print gave the same). Ok. I think I read backward the error printed in CI: it wanted to find a |
* go 1.17 has deprecated installing executables with `go get` Use go install instead Set GOFLAGS to empty string to overcome the `cannot query module due to -mod=vendor` error we get in presubmit job * Updated kustomize version to a version that support go install See kubernetes-sigs/kustomize#3618 * Install golangci-lint from source See golangci/golangci-lint#2374 * Fix lint issue See golangci/golangci-lint#2601 * Refactor - don't pass around origRes and origErr
Welcome
Description of the problem
With latest version of gci (1.44.1 was already regressing in imports, but differently), there are some errors if the import contains a comment on the next line.
For instance:
Version of golangci-lint
Configuration file
Go environment
Verbose output of running
Code example or link to a public repository
On https://github.com/ubuntu/adsys repo, in https://github.com/ubuntu/adsys/runs/5247363658, we get:
Here are the files header creating the issues:
(failure is on the line before
// #nosec:
)Another file:
Error is again, on the line before the comment.
Comments in imports are correctly formatted by go fmt, and gopls supports them.
The text was updated successfully, but these errors were encountered: