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

Katie.mckew/awsmc 1070 aws v2 terraform provider #2540

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

ktmq
Copy link
Contributor

@ktmq ktmq commented Aug 27, 2024

No description provided.

"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/path"
frameworkPath "github.com/hashicorp/terraform-plugin-framework/path"

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants