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

fix: golangci-lint error #170

Merged
merged 2 commits into from
Apr 26, 2024
Merged

fix: golangci-lint error #170

merged 2 commits into from
Apr 26, 2024

Conversation

FrankYang0529
Copy link
Contributor

Which issue(s) this PR fixes:

longhorn/longhorn#7448

What this PR does / why we need it:

Special notes for your reviewer:

Additional documentation or context

Copy link
Member

@innobead innobead left a comment

Choose a reason for hiding this comment

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

In general, LGTM. Just a few comments.

Just one feedback about when dealing an error but it's not critical and unhandled or it can be recovered eventually, suggest logging with warn level instead of error.

backupbackingimage/backupbackingimage.go Outdated Show resolved Hide resolved
deltablock.go Outdated Show resolved Hide resolved
fsops/fsops.go Outdated
@@ -127,7 +127,9 @@ func (f *FileSystemOperator) List(path string) ([]string, error) {
func (f *FileSystemOperator) Upload(src, dst string) error {
tmpDst := dst + ".tmp" + "." + strconv.FormatInt(time.Now().UTC().UnixNano(), 10)
if f.FileExists(tmpDst) {
f.Remove(tmpDst)
if err := f.Remove(tmpDst); err != nil {
return err
Copy link
Member

Choose a reason for hiding this comment

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

Should we handle this error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think we return error and for the caller to handle it. Or do you mean log it before return the error?

Copy link
Member

Choose a reason for hiding this comment

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

In the experience, usually removing files would be best efforts, so the error could not be handled. Or, we can just have a warn log, good enough? (of course, those temp files could be leftover.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, update to log a warning message. Thanks.

@FrankYang0529
Copy link
Contributor Author

Just one feedback about when dealing an error but it's not critical and unhandled or it can be recovered eventually, suggest logging with warn level instead of error.

Thank you. I change the log level to warning.

Signed-off-by: PoAn Yang <[email protected]>
@innobead innobead merged commit ac3867f into longhorn:master Apr 26, 2024
3 of 4 checks passed
@FrankYang0529 FrankYang0529 deleted the LH-7448 branch April 29, 2024 01:17
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