-
-
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
linting is failing on a file that should be ignored #998
Labels
bug
Something isn't working
Comments
I'm getting the same issue with Seems to work on one run then error on the next. I tried cleaning the cache each time but still same behaviour. |
This is still an issue with 1.25.1
|
ksoichiro
added a commit
to ksoichiro/golangci-lint
that referenced
this issue
May 3, 2020
If the target files contains `//line` directive and it indicates a non-go file, the linter is going to handle it as a go file, which results in failure. The cause of this issue is that the linters (`Analyzer`s) are using `pass.Fset.Position()`. This func returns the adjusted position using `//line` directive. The example project reported in golangci#998 has `//line` directive that indicates other non-go file. According to the description of "Compiler Directives” (https://golang.org/cmd/compile/#hdr-Compiler_Directives), line directives is mainly used for reporting original positions to the generators or something. On linters of golangci-lint, `pass.Fset.Position()` is used just to aggregate file names; we don't have to adjust positions. This changes `Analyzer`s that use `pass.Fset.Position()` to aggregate file names to use `pass.Fset.PositionFor()` with `adjusted == false`. Relates: golangci#998
jirfag
pushed a commit
that referenced
this issue
May 5, 2020
If the target files contains `//line` directive and it indicates a non-go file, the linter is going to handle it as a go file, which results in failure. The cause of this issue is that the linters (`Analyzer`s) are using `pass.Fset.Position()`. This func returns the adjusted position using `//line` directive. The example project reported in #998 has `//line` directive that indicates other non-go file. According to the description of "Compiler Directives” (https://golang.org/cmd/compile/#hdr-Compiler_Directives), line directives is mainly used for reporting original positions to the generators or something. On linters of golangci-lint, `pass.Fset.Position()` is used just to aggregate file names; we don't have to adjust positions. This changes `Analyzer`s that use `pass.Fset.Position()` to aggregate file names to use `pass.Fset.PositionFor()` with `adjusted == false`. Relates: #998
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please include the following information:
Version of golangci-lint
Config file
Go environment
Verbose output of running
Linting is failing on a file that should be ignored:
ast_parser.rl
Running error: gofmt: /go/src/github.com/sjansen/lolcode-go/internal/ast/ast_parser.rl:5:1: expected declaration, found '%' (and 29 more errors)
The text was updated successfully, but these errors were encountered: