Skip to content

Conversation

@fanny-jiang
Copy link
Contributor

What does this PR do?

A brief description of the change being made with this pull request.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Minimum Agent Versions

Are there minimum versions of the Datadog Agent and/or Cluster Agent required?

  • Agent: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

Write there any instructions and details you may have to test your PR.

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label

@codecov-commenter
Copy link

codecov-commenter commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.36%. Comparing base (012ab68) to head (c74d87f).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1936   +/-   ##
=======================================
  Coverage   50.36%   50.36%           
=======================================
  Files         228      228           
  Lines       21774    21774           
=======================================
  Hits        10967    10967           
  Misses      10259    10259           
  Partials      548      548           
Flag Coverage Δ
unittests 50.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 012ab68...c74d87f. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fanny-jiang fanny-jiang force-pushed the fanny/CECO-1512/gke-provisioner branch from dfedd16 to 0a946d1 Compare May 29, 2025 15:40
assert.NotEmpty(c, podsList.Items)
assert.Len(c, podsList.Items, numPods)
t.Log("PODSLIST COUNT: ", len(podsList.Items))
for pod, _ := range podsList.Items {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Code Quality Violation

Suggested change
for pod, _ := range podsList.Items {
for pod := range podsList.Items {
Unnecessary blank identifier (...read more)

In Go, when using range iterations or receiving values from channels, it is recommended to avoid assigning the iteration or received value to the blank identifier _. Instead, it is preferred to omit the assignment entirely.

Here's why it is best to use for range s {}x = someMap[key], and <-ch instead of using the blank identifier _:

  1. Clarity and Readability: By omitting the assignment entirely, it makes the code more readable and self-explanatory. Using _ can introduce confusion and make it less clear what the purpose of the assignment is or if the value is discarded intentionally or accidentally.
  2. Avoiding Variable Pollution: Using _ as an assignment can unnecessarily pollute the variable space. Although Go allows the use of the blank identifier _ to disregard a value, it is a good practice to avoid introducing unnecessary variables, especially if they are never used.
  3. Linting and static analysis: Some linting tools and static analyzers may flag the use of varName = _ as an indication of accidental assignment or failure to handle errors or returned values properly. Removing these assignments eliminates such warnings or false-positive detections.

For example, consider the following code snippets:

for _ = range aSlice {}
x, _ = something()
_ = <- aChannel
for range aSlice {}
x = something()
<-aChannel

Both snippets achieve the same result, but the second one that omits the assignments using _ is preferred for its simplicity, readability, and adherence to Go's best practices.

By using for range s {}x = someMap[key], and <-ch instead of assigning to _, you can write cleaner and more readable Go code while avoiding unnecessary variable assignments and potential confusion.

View in Datadog  Leave us feedback  Documentation

@fanny-jiang fanny-jiang force-pushed the fanny/CECO-1512/gke-provisioner branch from 6181791 to fadc4b3 Compare June 25, 2025 22:12
@fanny-jiang fanny-jiang force-pushed the fanny/CECO-1512/gke-provisioner branch from fadc4b3 to 22aceda Compare June 27, 2025 14:51
@fanny-jiang fanny-jiang force-pushed the fanny/CECO-1512/gke-provisioner branch from a4d3824 to 9d5ab36 Compare July 2, 2025 15:55
@fanny-jiang fanny-jiang force-pushed the fanny/CECO-1512/gke-provisioner branch from 9c4a086 to ae44a59 Compare July 11, 2025 14:38
@dd-octo-sts
Copy link

dd-octo-sts bot commented Oct 11, 2025

This pull request has been automatically marked as stale because it has not had activity in the past 15 days.

It will be closed in 30 days if no further activity occurs. If this pull request is still relevant, adding a comment or pushing new commits will keep it open. Also, you can always reopen the pull request if you missed the window.

Thank you for your contributions!

@dd-octo-sts dd-octo-sts bot added the stale label Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants