-
Notifications
You must be signed in to change notification settings - Fork 55
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
Create AWS Integrations v2 API spec #2516
Create AWS Integrations v2 API spec #2516
Conversation
34609c4
to
492dfc2
Compare
This issue has been automatically marked as stale because it has not had activity in the last 30 days. |
7427d29
to
742331b
Compare
bfdd058
to
87fc0bb
Compare
14aa259
to
b378646
Compare
7b4b781
to
0ab8a75
Compare
f2ebb50
to
c649648
Compare
c649648
to
1f638b5
Compare
func NewAWSAccountPatchRequestData(attributes AWSAccountPatchRequestAttributes) *AWSAccountPatchRequestData { | ||
this := AWSAccountPatchRequestData{} | ||
this.Attributes = attributes | ||
var typeVar string = "account" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "account" | |
var typeVar = "account" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
func NewAWSAccountResponseData(attributes AWSAccountResponseAttributes) *AWSAccountResponseData { | ||
this := AWSAccountResponseData{} | ||
this.Attributes = attributes | ||
var typeVar string = "account" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "account" | |
var typeVar = "account" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
func NewAWSAccountCreateRequestData(attributes AWSAccountCreateRequestAttributes) *AWSAccountCreateRequestData { | ||
this := AWSAccountCreateRequestData{} | ||
this.Attributes = attributes | ||
var typeVar string = "account" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "account" | |
var typeVar = "account" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
api/datadogV2/api_aws_integration.go
Outdated
} | ||
|
||
localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_id}" | ||
localVarPath = strings.Replace(localVarPath, "{"+"aws_account_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountId, "")), -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Code Quality Violation
localVarPath = strings.Replace(localVarPath, "{"+"aws_account_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountId, "")), -1) | |
localVarPath = strings.ReplaceAll(localVarPath, "{"+"aws_account_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountId, ""))) |
Do not call Replace with a negative limit, use ReplaceAll instead (...read more)
In Go, the strings.Replace()
function is used to replace a certain substring within a string with another substring. The function takes in four parameters: the original string, the old substring to be replaced, the new substring that will replace the old one, and an integer limit dictating how many replacements to be made.
Calling strings.Replace()
with a negative limit doesn't really make sense. According to the Go documentation, if limit is negative, there is no limit on the number of replacements. Which means it will replace all instances of old substring in the original string with a new substring.
For example:
fmt.Println(strings.Replace("oink oink oink", "k", "ky", -2))
In this example, Replace returns a copy of the string "oink oink oink" where "k" is replaced by "ky" everywhere it appears, because limit is -2.
So it's not necessarily "incorrect" to use a negative limit, but it can create misunderstandings in your code. It's best to use a limit of -1
when you want to replace all instances, as this convention is more commonly understood to mean "no limit".
But if you specifically want to avoid using negative limit for Replace or looking for replace method with better efficiency, using strings.NewReplacer()
could be a better option when there are multiple string pairs need to be replaced, where you can specify a list of old-new string pairs.
Or you can use strings.ReplaceAll()
. It is equivalent to Replace with a limit of -1
. It's arguably clearer and more self-explanatory than using a negative limit with strings.Replace()
.
For example:
fmt.Println(strings.ReplaceAll("oink oink oink", "o", "ky"))
It replaces all instances of "o" in the string "oink oink oink" by "ky".
1f638b5
to
231bda2
Compare
// but it doesn't guarantee that properties required by API are set. | ||
func NewAWSAccountResponseDataWithDefaults() *AWSAccountResponseData { | ||
this := AWSAccountResponseData{} | ||
var typeVar string = "account" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "account" | |
var typeVar = "account" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
// but it doesn't guarantee that properties required by API are set. | ||
func NewAWSAccountCreateRequestDataWithDefaults() *AWSAccountCreateRequestData { | ||
this := AWSAccountCreateRequestData{} | ||
var typeVar string = "account" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "account" | |
var typeVar = "account" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
// but it doesn't guarantee that properties required by API are set. | ||
func NewAWSAccountPatchRequestDataWithDefaults() *AWSAccountPatchRequestData { | ||
this := AWSAccountPatchRequestData{} | ||
var typeVar string = "account" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "account" | |
var typeVar = "account" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
231bda2
to
8556d57
Compare
} | ||
|
||
localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_config_id}" | ||
localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Code Quality Violation
localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) | |
localVarPath = strings.ReplaceAll(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, ""))) |
Do not call Replace with a negative limit, use ReplaceAll instead (...read more)
In Go, the strings.Replace()
function is used to replace a certain substring within a string with another substring. The function takes in four parameters: the original string, the old substring to be replaced, the new substring that will replace the old one, and an integer limit dictating how many replacements to be made.
Calling strings.Replace()
with a negative limit doesn't really make sense. According to the Go documentation, if limit is negative, there is no limit on the number of replacements. Which means it will replace all instances of old substring in the original string with a new substring.
For example:
fmt.Println(strings.Replace("oink oink oink", "k", "ky", -2))
In this example, Replace returns a copy of the string "oink oink oink" where "k" is replaced by "ky" everywhere it appears, because limit is -2.
So it's not necessarily "incorrect" to use a negative limit, but it can create misunderstandings in your code. It's best to use a limit of -1
when you want to replace all instances, as this convention is more commonly understood to mean "no limit".
But if you specifically want to avoid using negative limit for Replace or looking for replace method with better efficiency, using strings.NewReplacer()
could be a better option when there are multiple string pairs need to be replaced, where you can specify a list of old-new string pairs.
Or you can use strings.ReplaceAll()
. It is equivalent to Replace with a limit of -1
. It's arguably clearer and more self-explanatory than using a negative limit with strings.Replace()
.
For example:
fmt.Println(strings.ReplaceAll("oink oink oink", "o", "ky"))
It replaces all instances of "o" in the string "oink oink oink" by "ky".
1852b9d
to
2d2d073
Compare
api/datadogV2/api_aws_integration.go
Outdated
} | ||
|
||
localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_config_id}" | ||
localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Code Quality Violation
localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) | |
localVarPath = strings.ReplaceAll(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, ""))) |
Do not call Replace with a negative limit, use ReplaceAll instead (...read more)
In Go, the strings.Replace()
function is used to replace a certain substring within a string with another substring. The function takes in four parameters: the original string, the old substring to be replaced, the new substring that will replace the old one, and an integer limit dictating how many replacements to be made.
Calling strings.Replace()
with a negative limit doesn't really make sense. According to the Go documentation, if limit is negative, there is no limit on the number of replacements. Which means it will replace all instances of old substring in the original string with a new substring.
For example:
fmt.Println(strings.Replace("oink oink oink", "k", "ky", -2))
In this example, Replace returns a copy of the string "oink oink oink" where "k" is replaced by "ky" everywhere it appears, because limit is -2.
So it's not necessarily "incorrect" to use a negative limit, but it can create misunderstandings in your code. It's best to use a limit of -1
when you want to replace all instances, as this convention is more commonly understood to mean "no limit".
But if you specifically want to avoid using negative limit for Replace or looking for replace method with better efficiency, using strings.NewReplacer()
could be a better option when there are multiple string pairs need to be replaced, where you can specify a list of old-new string pairs.
Or you can use strings.ReplaceAll()
. It is equivalent to Replace with a limit of -1
. It's arguably clearer and more self-explanatory than using a negative limit with strings.Replace()
.
For example:
fmt.Println(strings.ReplaceAll("oink oink oink", "o", "ky"))
It replaces all instances of "o" in the string "oink oink oink" by "ky".
70b8f14
to
09af02f
Compare
// will change when the set of required properties is changed. | ||
func NewAWSLogsServicesResponseData() *AWSLogsServicesResponseData { | ||
this := AWSLogsServicesResponseData{} | ||
var id string = "get_logs_services" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var id string = "get_logs_services" | |
var id = "get_logs_services" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
this := AWSNewExternalIDResponseData{} | ||
var id string = "generate_new_external_id" | ||
this.Id = &id | ||
var typeVar string = "generate_new_external_id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "generate_new_external_id" | |
var typeVar = "generate_new_external_id" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
// will change when the set of required properties is changed. | ||
func NewAWSNamespacesResponseData() *AWSNamespacesResponseData { | ||
this := AWSNamespacesResponseData{} | ||
var typeVar string = "namespace" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "namespace" | |
var typeVar = "namespace" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
this := AWSLogsServicesResponseData{} | ||
var id string = "get_logs_services" | ||
this.Id = &id | ||
var typeVar string = "logs_services" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "logs_services" | |
var typeVar = "logs_services" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
// will change when the set of required properties is changed. | ||
func NewAWSNewExternalIDResponseData() *AWSNewExternalIDResponseData { | ||
this := AWSNewExternalIDResponseData{} | ||
var id string = "generate_new_external_id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var id string = "generate_new_external_id" | |
var id = "generate_new_external_id" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
09af02f
to
bdb4601
Compare
// but it doesn't guarantee that properties required by API are set. | ||
func NewAWSNamespacesResponseDataWithDefaults() *AWSNamespacesResponseData { | ||
this := AWSNamespacesResponseData{} | ||
var typeVar string = "namespace" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "namespace" | |
var typeVar = "namespace" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
this := AWSNewExternalIDResponseData{} | ||
var id string = "generate_new_external_id" | ||
this.Id = &id | ||
var typeVar string = "generate_new_external_id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "generate_new_external_id" | |
var typeVar = "generate_new_external_id" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
// but it doesn't guarantee that properties required by API are set. | ||
func NewAWSNewExternalIDResponseDataWithDefaults() *AWSNewExternalIDResponseData { | ||
this := AWSNewExternalIDResponseData{} | ||
var id string = "generate_new_external_id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var id string = "generate_new_external_id" | |
var id = "generate_new_external_id" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
this := AWSLogsServicesResponseData{} | ||
var id string = "get_logs_services" | ||
this.Id = &id | ||
var typeVar string = "logs_services" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "logs_services" | |
var typeVar = "logs_services" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
} | ||
|
||
localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_config_id}" | ||
localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Code Quality Violation
localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) | |
localVarPath = strings.ReplaceAll(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, ""))) |
Do not call Replace with a negative limit, use ReplaceAll instead (...read more)
In Go, the strings.Replace()
function is used to replace a certain substring within a string with another substring. The function takes in four parameters: the original string, the old substring to be replaced, the new substring that will replace the old one, and an integer limit dictating how many replacements to be made.
Calling strings.Replace()
with a negative limit doesn't really make sense. According to the Go documentation, if limit is negative, there is no limit on the number of replacements. Which means it will replace all instances of old substring in the original string with a new substring.
For example:
fmt.Println(strings.Replace("oink oink oink", "k", "ky", -2))
In this example, Replace returns a copy of the string "oink oink oink" where "k" is replaced by "ky" everywhere it appears, because limit is -2.
So it's not necessarily "incorrect" to use a negative limit, but it can create misunderstandings in your code. It's best to use a limit of -1
when you want to replace all instances, as this convention is more commonly understood to mean "no limit".
But if you specifically want to avoid using negative limit for Replace or looking for replace method with better efficiency, using strings.NewReplacer()
could be a better option when there are multiple string pairs need to be replaced, where you can specify a list of old-new string pairs.
Or you can use strings.ReplaceAll()
. It is equivalent to Replace with a limit of -1
. It's arguably clearer and more self-explanatory than using a negative limit with strings.Replace()
.
For example:
fmt.Println(strings.ReplaceAll("oink oink oink", "o", "ky"))
It replaces all instances of "o" in the string "oink oink oink" by "ky".
bdb4601
to
f59b34b
Compare
// but it doesn't guarantee that properties required by API are set. | ||
func NewAWSLogsServicesResponseDataWithDefaults() *AWSLogsServicesResponseData { | ||
this := AWSLogsServicesResponseData{} | ||
var id string = "get_logs_services" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var id string = "get_logs_services" | |
var id = "get_logs_services" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
this := AWSNamespacesResponseData{} | ||
var id string = "namespaces" | ||
this.Id = &id | ||
var typeVar string = "namespaces" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "namespaces" | |
var typeVar = "namespaces" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
f59b34b
to
8b80f65
Compare
// but it doesn't guarantee that properties required by API are set. | ||
func NewAWSNamespacesResponseDataWithDefaults() *AWSNamespacesResponseData { | ||
this := AWSNamespacesResponseData{} | ||
var id string = "namespaces" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var id string = "namespaces" | |
var id = "namespaces" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
this := AWSNamespacesResponseData{} | ||
var id string = "namespaces" | ||
this.Id = &id | ||
var typeVar string = "namespaces" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Code Quality Violation
var typeVar string = "namespaces" | |
var typeVar = "namespaces" |
redundant type declaration (...read more)
In Go, it is considered good practice to avoid declaring the type when it is obvious or when the type can be inferred from the assignment. This is known as type inference, and it offers several benefits:
- Readability: By omitting the explicit type declaration, the code becomes more concise and easier to read. Redundant type declarations can clutter the code and introduce unnecessary noise. When the type is obvious from the assigned value, omitting the type declaration can improve code readability and make it more expressive.
- Flexibility and maintainability: Using type inference allows for easier changes to the underlying type without manually updating every instance where it is declared. If the type needs to be changed in the future, you only need to modify the assignment, and Go's type inference mechanism will handle the rest. This reduces the maintenance effort required and improves code maintainability.
- Clean code appearance: Omitting the type declaration when it is obvious results in cleaner code syntax. Code that is free from excessive explicit type declarations tends to look more elegant and consistent. It minimizes redundancy and focuses on the essential logic, contributing to a cleaner and more streamlined codebase.
- Compatibility: Go's type inference mechanism ensures compatibility with future changes to the type of the assigned value. If the assigned value is changed to a type-compatible value, the code will continue to compile and run without any modifications. This allows for flexibility in your code while maintaining correctness.
That being said, it is important to strike a balance and avoid excessive use of type inference. Clear and explicit type declarations are still valuable when they enhance code clarity, such as when documenting or expressing the intent of the code. It is essential to find the right balance between brevity and clarity in your codebase.
By utilizing Go's type inference mechanism and avoiding explicit type declarations when the type is obvious, you can achieve more readable, maintainable, and concise code that adheres to Go's idiomatic style.
00157c8
to
6492b3c
Compare
6492b3c
to
b69e7e1
Compare
} | ||
|
||
localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_config_id}" | ||
localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Code Quality Violation
localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) | |
localVarPath = strings.ReplaceAll(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, ""))) |
Do not call Replace with a negative limit, use ReplaceAll instead (...read more)
In Go, the strings.Replace()
function is used to replace a certain substring within a string with another substring. The function takes in four parameters: the original string, the old substring to be replaced, the new substring that will replace the old one, and an integer limit dictating how many replacements to be made.
Calling strings.Replace()
with a negative limit doesn't really make sense. According to the Go documentation, if limit is negative, there is no limit on the number of replacements. Which means it will replace all instances of old substring in the original string with a new substring.
For example:
fmt.Println(strings.Replace("oink oink oink", "k", "ky", -2))
In this example, Replace returns a copy of the string "oink oink oink" where "k" is replaced by "ky" everywhere it appears, because limit is -2.
So it's not necessarily "incorrect" to use a negative limit, but it can create misunderstandings in your code. It's best to use a limit of -1
when you want to replace all instances, as this convention is more commonly understood to mean "no limit".
But if you specifically want to avoid using negative limit for Replace or looking for replace method with better efficiency, using strings.NewReplacer()
could be a better option when there are multiple string pairs need to be replaced, where you can specify a list of old-new string pairs.
Or you can use strings.ReplaceAll()
. It is equivalent to Replace with a limit of -1
. It's arguably clearer and more self-explanatory than using a negative limit with strings.Replace()
.
For example:
fmt.Println(strings.ReplaceAll("oink oink oink", "o", "ky"))
It replaces all instances of "o" in the string "oink oink oink" by "ky".
223ff68
to
42a51a7
Compare
4df0988
to
f17f7b3
Compare
f17f7b3
to
73f5e2c
Compare
Co-authored-by: ci.datadog-api-spec <[email protected]> 859ddc4
See DataDog/datadog-api-spec#2813
Test branch datadog-api-spec/test/jon.vanbriesen/aws-v2-spec