-
-
Notifications
You must be signed in to change notification settings - Fork 164
typecheck incorrectly complains of "operator == not defined on untyped nil" #624
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
Comments
Also still an issue with |
@ldez I am facing the same issue as well. on |
I'm also seeing this happen when comparing the value of a function that returns an interface to nil, which shouldn't be a problem, since interfaces are pointers. Compiles without issue. |
Of course, this is just as good as the compiler itself and a lot of compilation issues will not properly show where in the code your error lies. https://golangci-lint.run/welcome/faq/#why-do-you-have-typecheck-errors
If there is a difference between local and CI, it's because some elements (not related to golangci-lint) are missing (ex: if using CGO, ensure all required system libraries are installed.) |
And yet in all the cases above the code does compile, and in all cases can be trivially seen to be the case. This should not be closed, it should be fixed. |
This issue is open on the GitHub Action repository, this issue is not related to GitHub Action, I ran I can see that you are using an old version of the GitHub Action (latest version is v5): https://github.com/elastic/beats/blob/c1748f7965c9bfd4d488403bb2a734f6f5627219/.github/workflows/golangci-lint.yml#L42 Once again, So, if you can create a minimal reproducible example or if you have something reproducible, you can open an issue on the golangci-lint repository. |
The example shown in #624 (comment) is against a package that has no Cgo dep. |
$ git clone [email protected]:elastic/beats.git
Cloning into 'beats'...
remote: Enumerating objects: 387776, done.
remote: Counting objects: 100% (1362/1362), done.
remote: Compressing objects: 100% (835/835), done.
remote: Total 387776 (delta 801), reused 871 (delta 503), pack-reused 386414
Receiving objects: 100% (387776/387776), 415.04 MiB | 6.01 MiB/s, done.
Resolving deltas: 100% (244063/244063), done.
$ cd beats
$ golangci-lint run ./x-pack/filebeat/input/cel/
WARN [config_reader] The configuration option `linters.staticcheck.go` is deprecated, please use global `run.go`.
WARN [config_reader] The configuration option `linters.gosimple.go` is deprecated, please use global `run.go`.
WARN [config_reader] The configuration option `linters.stylecheck.go` is deprecated, please use global `run.go`.
x-pack/filebeat/input/cel/input_test.go:450:15: Error return value of `io.ReadAll` is not checked (errcheck)
io.ReadAll(r.Body)
^
x-pack/filebeat/input/cel/input_test.go:452:12: Error return value of `w.Write` is not checked (errcheck)
w.Write([]byte(text))
^ |
Yeah, I know. It doesn't fail locally, only here. This is why it's filed against this repo and not that one. I think this is going around in circles. |
It's an environmental problem:
The problem is not directly related to golangci-lint or the action, golangci-lint is just influenced by something inside your CI. So, you are asking me to debug your CI. If I work on that, I will need to have something that currently doesn't work on your CI as a starting point. |
I think the problem is here: https://github.com/elastic/beats/blob/c1748f7965c9bfd4d488403bb2a734f6f5627219/.github/workflows/golangci-lint.yml#L15-L22 golangci:
strategy:
matrix:
include:
- GOOS: windows
- GOOS: linux
- GOOS: darwin
name: lint
runs-on: ubuntu-latest You are playing with In the end, you have issues not properly showing where in the code your error lies because the problem is somewhere else. |
Thank you for the analysis, that is helpful. I apologise if I appear aggressive; having non-engagement for two years and then a close without discussion is frustrating. |
To be honest, I didn't respond sooner because, since your message about "differences in opinion about approaches to linting at scale", I was afraid of your reaction. I put a lot of effort into improving I tried to provide all information when I closed the issue, but it was not enough, I'm sorry, I will improve that. |
Thank you. I will try harder too. |
Welcome
Description of the problem
We are seeing the following. This should not be happening since the spec says (my emphasis):
This does not happen locally.
The issue looks to be related to https://go.dev/issue/39755.
Version of golangci-lint
v1.47.2
Version of the GitHub Action
Question not clearly defined.
Workflow file
Go version
go1.18.9
Code example or link to a public repository
https://github.com/elastic/beats/pull/34044/files#annotation_7094626396
The text was updated successfully, but these errors were encountered: