Skip to content
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

gci error not clear #59

Closed
georgettica opened this issue Mar 18, 2022 · 5 comments
Closed

gci error not clear #59

georgettica opened this issue Mar 18, 2022 · 5 comments

Comments

@georgettica
Copy link

the error

pass.Reportf(file.Pos(diffIdx), "Expected %s, Found %s at %s[line %d,col %d]", formattedRune, fileRune, filePath, diffPos.Line, diffPos.Column)

jumped for me when I had

import (
        "fmt"
        "reflect"

        "github.com/go-pg/pg/v10"
        "github.com/go-pg/pg/v10/orm"

        "github.com/spf13/cobra"
)

and the fix was to join the 3 github imports.

could we catch this error up somewhere so the error would be more along the lines "imports are not joined together, please remove newline in line X" ?

the error is

file.go:X:${LAST_CHAR_IN_LINE}: Expected '\t', Found '\n' at file.go[line X col ${LAST_CHAR_IN_LINE}] (gci)
@KenjiTakahashi
Copy link

I've just added gci to my golangci-lint config and immediately got a bunch of errors like this:

Expected 'u', Found '"' at user.go[line 27,col 2]
Expected 'g', Found 'b' at processor.go[line 9,col 3]
Expected '"', Found 's' at main.go[line 10,col 2]

Etc.

It could really use a more readable error message, at first I thought the integration is just broken.

@georgettica
Copy link
Author

I can also say rust is doing this very good for semicolon position.
It literally shows in the error message where you should add it

@ngehrsitz
Copy link
Contributor

@georgettica The error reporting in gci is an area that could definitely improved. Until that happens I would recommend that you run gci in write mode to see what output gci expects.

inancgumus added a commit to grafana/xk6-browser that referenced this issue May 18, 2022
Renamings:

* `RT` -> `Runtime`
* `k6.NewMockVU` -> `k6test.NewVU`
* `V` -> `ToGojaValue`
* `TestBrowser.RT|V` -> `.runtime|toGojaValue`

I split the `k6` package into `k6` and `k6test`. By the way, note that
I needed to use `//nolint` in a couple of places because the gci linter
has bugs that prevent me from passing the linter
(see: daixiang0/gci#59).
inancgumus added a commit to grafana/xk6-browser that referenced this issue May 18, 2022
Renamings:

* `RT` -> `Runtime`
* `k6.NewMockVU` -> `k6test.NewVU`
* `V` -> `ToGojaValue`
* `TestBrowser.RT|V` -> `.runtime|toGojaValue`

I split the `k6` package into `k6` and `k6test`. By the way, note that
I needed to use `//nolint` in a couple of places because the gci linter
has bugs that prevent me from passing the linter
(see: daixiang0/gci#59).
inancgumus added a commit to grafana/xk6-browser that referenced this issue May 18, 2022
Renamings:

* `RT` -> `Runtime`
* `k6.NewMockVU` -> `k6test.NewVU`
* `V` -> `ToGojaValue`
* `TestBrowser.RT|V` -> `.runtime|toGojaValue`

I split the `k6` package into `k6` and `k6test`. By the way, note that
I needed to use `//nolint` in a couple of places because the gci linter
has bugs that prevent me from passing the linter
(see: daixiang0/gci#59).
@daixiang0
Copy link
Owner

You can try latest version :)

@georgettica
Copy link
Author

I will do that soon and report back, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants