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

[chore] Fix new lint issues with golangci-lint v1.56.1 #31240

Closed
songy23 opened this issue Feb 13, 2024 · 14 comments · Fixed by #31830
Closed

[chore] Fix new lint issues with golangci-lint v1.56.1 #31240

songy23 opened this issue Feb 13, 2024 · 14 comments · Fixed by #31830
Assignees
Labels
ci-cd CI, CD, testing, build issues good first issue Good for newcomers help wanted Extra attention is needed

Comments

@songy23
Copy link
Member

songy23 commented Feb 13, 2024

Component(s)

No response

Describe the issue you're reporting

The version upgrade of golangci #31216 surfaced lots of new lint errors, e.g. https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/7892240476/job/21538478567?pr=31216. Need to fix these lint errors to unblock #31216.

@songy23 songy23 added help wanted Extra attention is needed good first issue Good for newcomers needs triage New item requiring triage labels Feb 13, 2024
@songy23
Copy link
Member Author

songy23 commented Feb 13, 2024

To reproduce: checkout branch renovate/github.com-golangci-golangci-lint-1.x then run make lint.

codeboten pushed a commit that referenced this issue Feb 15, 2024
This is only a part of the failures, but there's so many i'd rather not
submit a single massive PR.

Related to
#31240

Signed-off-by: Alex Boten <aboten@lightstep.com>
codeboten pushed a commit that referenced this issue Feb 15, 2024
Related
#31240

Signed-off-by: Alex Boten <aboten@lightstep.com>
@crobert-1 crobert-1 added ci-cd CI, CD, testing, build issues and removed needs triage New item requiring triage labels Feb 26, 2024
@crobert-1
Copy link
Member

Removing needs triage as it's been worked on by a project maintainer.

led0nk added a commit to led0nk/opentelemetry-collector-contrib that referenced this issue Mar 12, 2024
XinRanZhAWS pushed a commit to XinRanZhAWS/opentelemetry-collector-contrib that referenced this issue Mar 13, 2024
This is only a part of the failures, but there's so many i'd rather not
submit a single massive PR.

Related to
open-telemetry#31240

Signed-off-by: Alex Boten <aboten@lightstep.com>
XinRanZhAWS pushed a commit to XinRanZhAWS/opentelemetry-collector-contrib that referenced this issue Mar 13, 2024
Related
open-telemetry#31240

Signed-off-by: Alex Boten <aboten@lightstep.com>
codeboten pushed a commit that referenced this issue Mar 13, 2024
**Description:** 
linting error with:

```
INFO [runner] linters took 1.336744316s with stages: goanalysis_metalinter: 1.334941582s 
opentelemetry-collector-contrib/cmd/checkapi/main.go:50:66: unused-parameter: parameter 'err' seems to be unused, consider removing or renaming it as _ (revive)
	err = filepath.Walk(folder, func(path string, info fs.FileInfo, err error) error {
	                                                                ^
```
and: 
```
INFO [runner] linters took 1.806204856s with stages: goanalysis_metalinter: 1.80522593s 
opentelemetry-collector-contrib/cmd/checkapi/main.go:53:18: shadow: declaration of "err" shadows declaration at line 44 (govet)
			relativeBase, err := filepath.Rel(folder, base)
			              ^
```

**Link to tracking Issue:** <Issue number if applicable>
- #31240


**Testing:** <Describe what testing was performed and which tests were
added.>

**Documentation:** <Describe the documentation added.>
@led0nk
Copy link
Contributor

led0nk commented Mar 25, 2024

@songy23 i cannot reproduce any other linting errors, so it seems like it's solved for now

@songy23
Copy link
Member Author

songy23 commented Mar 25, 2024

mx-psi pushed a commit that referenced this issue Mar 25, 2024
**Description:** <Describe what has changed.>
- Linting Errors: 

[https://productionresultssa5.blob.core.windows.net/actions-results/44e4093a-f4c1-4e35-af4f-d630ea9b8d68/workflow-job-run-071cf28a-9760-544e-287f-c0f9ae5a03a4/logs/job/job-logs.txt?rsct=text%2Fplain&se=2024-03-25T12%3A45%3A21Z&sig=fRzhKwEpzDQDQZyUYwvEY%2BhkcFWOD3IY0EeCOE47AeU%3D&sp=r&spr=https&sr=b&st=2024-03-25T12%3A35%3A16Z&sv=2021-12-02](url)

- some linting errors will be fixed by 
#30237 


**Link to tracking Issue:** <Issue number if applicable>
- #31240 

**Testing:** <Describe what testing was performed and which tests were
added.>

**Documentation:** <Describe the documentation added.>
@mx-psi mx-psi linked a pull request Mar 25, 2024 that will close this issue
1 task
@mx-psi
Copy link
Member

mx-psi commented Mar 25, 2024

@songy23
Copy link
Member Author

songy23 commented Mar 25, 2024

^ the one in opampsupervisor is expected to be fixed in #30237.

@led0nk
Copy link
Contributor

led0nk commented Mar 25, 2024

^ the one in opampsupervisor is expected to be fixed in #30237.

actually the one won't be fixed through #30237 (as you can see line 243 isn't touched)

There were other one's which would've been obsolete.
Should've seen this one earlier, sorry for that - just opened PR to quickly fix this

dmitryax pushed a commit that referenced this issue Mar 25, 2024
**Description:** should be the last one

**Link to tracking Issue:** 
- #31240
@led0nk
Copy link
Contributor

led0nk commented Mar 25, 2024

@songy23 is there any way to preproduce linting with the updated linter in #31830 ?
with updated upstream-repo i'm not able to reproduce these linting errors...

I think it should be more efficient to run this locally one by one , so we can solve this in a single PR.

@songy23
Copy link
Member Author

songy23 commented Mar 26, 2024

@led0nk Looks like I had a typo in my previous comment. You can run make golint after checkout the branch

git checkout renovate/github.com-golangci-golangci-lint-1.x
make golint

The command takes long and you'll need to run it after each fix. Here's what I got with running ^

INFO [runner] linters took 988.335125ms with stages: goanalysis_metalinter: 987.281709ms 
chronyreceiver/factory.go:41:32: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
		scraperhelper.WithStart(func(ctx context.Context, host component.Host) error {
		                             ^

And thanks for helping out here!

@led0nk led0nk mentioned this issue Mar 27, 2024
58 tasks
djaglowski pushed a commit that referenced this issue Mar 27, 2024
**Description:** 
This PR should solve the related Issue linked below.
I tried to switch to blank identifiers instead of removing function
arguments, so it could be adapted later on.

 linting erros in following pkgs:

- [x] cmd/configschema
- [x] cmd/githubgen
- [x] connector/datadogconnector
- [x] connector/grafanacloudconnector
- [x] connector/servicegraphconnector
- [x] exporter/awsemfexporter
- [x] exporter/awsxrayexporter
- [x] exporter/clickhouseexporter
- [x] exporter/datadogexporter
- [x] exporter/dynatraceexporter
- [x] exporter/elasticsearchexporter
- [x] exporter/honeycombmarkerexporter
- [x] exporter/influxdbexporter
- [x] exporter/instanaexporter
- [x] exporter/kafkaexporter
- [x] exporter/kineticaexporter
- [x] exporter/loadbalancingexporter
- [x] exporter/logicmonitorexporter
- [x] exporter/logzioexporter
- [x] exporter/lokiexporter
- [x] exporter/mezmoexporter
- [x] exporter/opensearchexporter
- [x] exporter/prometheusexporter
- [x] exporter/signalfxexporter
- [x] exporter/splunkhecexporter
- [x] exporter/sumologicexporter
- [x] exporter/zipkinexporter
- [x] extension/jaegerremotesampling
- [x] extension/oauth2clientauthextension
- [x] extension/observer
- [x] extension/oidcauthextension
- [x] extension/sumologicextension
- [x] internal/aws
- [x] internal/coreinternal
- [x] internal/filter
- [x] internal/kubelet
- [x] internal/metadataproviders
- [x] internal/sharedcomponent
- [x] pkg/ottl
- [x] pkg/pdatautil
- [x] pkg/stanza
- [x] pkg/translator
- [x] processor/deltatocumulativeprocessor
- [x] processor/filterprocessor
- [x] processor/groupbytraceprocessor
- [x] processor/k8sattributesprocessor
- [x] processor/logstransformprocessor
- [x] processor/metricstransformprocessor
- [x] processor/resourcedetectionprocessor
- [x] processor/tailsamplingprocessor
- [x] processor/transformprocessor
- [x] receiver/awscontainerinsightreceiver
- [x] receiver/chronyreceiver
- [x] receiver/splunkhecreceiver
- [x] receiver/sqlqueryreceiver
- [x] receiver/vcenterreceiver
- [x] receiver/webhookeventreceiver
- [x] receiver/zookeeperreceiver



**Link to tracking Issue:** 
- #31240 

**Testing:** <Describe what testing was performed and which tests were
added.>

**Documentation:** <Describe the documentation added.>
@led0nk
Copy link
Contributor

led0nk commented Mar 27, 2024

hopefully this should fix the remaning errors for PR #31830

i don't get any more errors from linting

@songy23
Copy link
Member Author

songy23 commented Mar 27, 2024

@led0nk
Copy link
Contributor

led0nk commented Mar 27, 2024

Okay i fixed this with recent PRs and no more linting errors on updated renovate-branch.
I hope there are no PRs in the meantime and #31830 won't get any errors.. 🥲

dmitryax added a commit that referenced this issue Mar 27, 2024
**Description:**
quick fix of recent pr with linting error (for updating linter)

**Link to tracking Issue:**
- #31240 

---------

Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
@songy23
Copy link
Member Author

songy23 commented Mar 27, 2024

All good, cheers @led0nk

@dmitryax
Copy link
Member

Thank you, @led0nk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-cd CI, CD, testing, build issues good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
5 participants