Skip to content

Conversation

tobz
Copy link
Member

@tobz tobz commented Jun 4, 2025

What does this PR do?

Backport of #1951.

Motivation

No intention of merging this PR, but wanted to submit it as a PR to have kind of a paper trail that we're building a custom image from it that will be used temporarily on a few clusters while we wait for v1.16.0.

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

@tobz tobz requested review from a team as code owners June 4, 2025 17:57
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/DataDog/datadog-operator/api/datadoghq/common"
apicommon "github.com/DataDog/datadog-operator/api/datadoghq/common"

Choose a reason for hiding this comment

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

Code Quality Violation

Verify that importing the same package multiple times is necessary. (...read more)

In Go, duplicate imports refer to importing the same package multiple times in a single file. It is considered a best practice to avoid duplicate imports in Go for the following reasons:

  1. Code readability and maintainability: Duplicate imports can make code harder to read and understand. When the same package is imported multiple times, it can lead to confusion and make it more difficult to determine the source of a particular symbol or function. Keeping imports concise and free of duplicates helps improve code readability and maintainability.
  2. Name conflicts: Duplicate imports introduce the risk of name conflicts. If the same package is imported multiple times, Go does not distinguish between them, which can result in name clashes between symbols from different imports. This can cause compilation errors or unexpected behavior, making the code prone to bugs and difficult to troubleshoot.
  3. Package initialization: Each package in Go can have an initialization function, init(), which is executed during package initialization. When the same package is imported multiple times, the init() function is run multiple times as well. This can lead to unexpected side effects and violate assumptions made by the package initialization code.
  4. Compilation efficiency: Duplicate imports can impact compilation time and increase the size of the resulting binary. The Go compiler needs to process each imported package, and duplicating imports can cause unnecessary overhead during the build process.

To avoid these issues, it is recommended to keep imports concise and remove any duplicates. Go provides a handy feature where you can group multiple imports from the same package on a single line, reducing duplication. Additionally, using aliases when necessary can help resolve naming conflicts between symbols from different packages.

View in Datadog  Leave us feedback  Documentation

@tobz tobz changed the base branch from main to tobz/v1.15.0-backport June 4, 2025 17:58
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.37%. Comparing base (6c847c2) to head (d2c67f0).

Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                   @@
##           tobz/v1.15.0-backport    #1954   +/-   ##
======================================================
  Coverage                  50.36%   50.37%           
======================================================
  Files                        228      228           
  Lines                      21774    21776    +2     
======================================================
+ Hits                       10967    10969    +2     
  Misses                     10259    10259           
  Partials                     548      548           
Flag Coverage Δ
unittests 50.37% <100.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
pkg/agentprofile/agent_profile.go 71.87% <100.00%> (+0.16%) ⬆️

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 6c847c2...d2c67f0. Read the comment docs.

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

Copy link
Contributor

@maycmlee maycmlee left a comment

Choose a reason for hiding this comment

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

Nothing for docs to review

@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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants