Skip to content

Revert "chore: bump cloud.google.com/go/logging from 1.13.2 to 1.15.0"#2130

Open
cowsking wants to merge 1 commit intomainfrom
revert-2129-dependabot/go_modules/cloud.google.com/go/logging-1.15.0
Open

Revert "chore: bump cloud.google.com/go/logging from 1.13.2 to 1.15.0"#2130
cowsking wants to merge 1 commit intomainfrom
revert-2129-dependabot/go_modules/cloud.google.com/go/logging-1.15.0

Conversation

@cowsking
Copy link
Copy Markdown
Contributor

Reverts #2129 as test failed in Prow

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request downgrades several Google Cloud dependencies, including logging, IAM, and longrunning, and updates the vendored source code. The review feedback identifies several regressions introduced by these changes, specifically the use of the deprecated 'io/ioutil' package and instances of variable shadowing in generated files. These issues should be addressed to maintain code quality and adhere to modern Go standards.

package internal

import (
"io/ioutil"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The 'io/ioutil' package is deprecated since Go 1.16. This import should be removed if the usage of 'ioutil.ReadFile' is replaced with 'os.ReadFile'.

References
  1. Linting is done with golangci-lint, which typically flags the use of deprecated packages like 'io/ioutil'. (link)
  2. The 'io/ioutil' package is deprecated. Use the 'os' or 'io' packages instead.

func (g *defaultResourceGetter) ReadAll(path string) string {
bytes, err := os.ReadFile(path)
bytes, err := ioutil.ReadFile(path)
if err != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The 'io/ioutil' package is deprecated since Go 1.16. It is recommended to use 'os.ReadFile' instead, which is already available in the 'os' package imported in this file.

	bytes, err := os.ReadFile(path)
References
  1. Linting is done with golangci-lint, which flags the use of deprecated functions like 'ioutil.ReadFile'. (link)
  2. The 'io/ioutil' package is deprecated. Use 'os.ReadFile' instead.

Comment on lines +248 to 250
if x, ok := x.GetPayload().(*LogEntry_ProtoPayload); ok {
return x.ProtoPayload
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Shadowing the receiver variable 'x' with the result of a type assertion is confusing and can lead to subtle bugs. It is better to use a unique variable name for the type-asserted value.

Suggested change
if x, ok := x.GetPayload().(*LogEntry_ProtoPayload); ok {
return x.ProtoPayload
}
if p, ok := x.GetPayload().(*LogEntry_ProtoPayload); ok {
return p.ProtoPayload
}
References
  1. Linting is done with golangci-lint, which includes checks for variable shadowing. (link)
  2. Avoid shadowing variables, especially receivers, as it reduces code clarity and can lead to errors.

Comment on lines +255 to 257
if x, ok := x.GetPayload().(*LogEntry_TextPayload); ok {
return x.TextPayload
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Shadowing the receiver variable 'x' with the result of a type assertion is confusing. Consider using a different variable name for the asserted value.

Suggested change
if x, ok := x.GetPayload().(*LogEntry_TextPayload); ok {
return x.TextPayload
}
if p, ok := x.GetPayload().(*LogEntry_TextPayload); ok {
return p.TextPayload
}
References
  1. Linting is done with golangci-lint, which flags variable shadowing. (link)
  2. Avoid shadowing variables to maintain code readability and prevent logic errors.

Comment on lines +262 to 264
if x, ok := x.GetPayload().(*LogEntry_JsonPayload); ok {
return x.JsonPayload
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Shadowing the receiver variable 'x' with the result of a type assertion is confusing. Consider using a different variable name for the asserted value.

Suggested change
if x, ok := x.GetPayload().(*LogEntry_JsonPayload); ok {
return x.JsonPayload
}
if p, ok := x.GetPayload().(*LogEntry_JsonPayload); ok {
return p.JsonPayload
}
References
  1. Linting is done with golangci-lint, which flags variable shadowing. (link)
  2. Avoid shadowing variables to maintain code readability and prevent logic errors.

Copy link
Copy Markdown
Contributor

@tiffanny29631 tiffanny29631 left a comment

Choose a reason for hiding this comment

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

/lgtm

@google-oss-prow
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tiffanny29631

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tiffanny29631
Copy link
Copy Markdown
Contributor

/retest

1 similar comment
@cowsking
Copy link
Copy Markdown
Contributor Author

/retest

@cowsking
Copy link
Copy Markdown
Contributor Author

/test all

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.

2 participants