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 wrapping errors #196

Merged
merged 2 commits into from Mar 25, 2022
Merged

Fix wrapping errors #196

merged 2 commits into from Mar 25, 2022

Conversation

AkihiroSuda
Copy link
Member

  • fmt.Errorf: use %w, not %v to wrap errors
  • fs: fix wrapping nil err

Follow-up to:

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@dmcgowan dmcgowan added this to Ready For Review in Code Review Mar 25, 2022
Copy link
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@estesp estesp merged commit cd17c99 into containerd:main Mar 25, 2022
Code Review automation moved this from Ready For Review to Done Mar 25, 2022
@@ -158,7 +158,9 @@ func copyDirectory(dst, src string, inodes map[uint64]string, o *copyDirOpts) er
}
default:
// TODO: Support pipes and sockets
return fmt.Errorf("unsupported mode %s: %w", fi.Mode(), err)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

I don't see how this can ever be non-nil.

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦 my bad

return fmt.Errorf("unsupported mode %s: %w", fi.Mode(), err)
if err != nil {
return fmt.Errorf("unsupported mode %s: %w", fi.Mode(), err)
}
Copy link
Member

Choose a reason for hiding this comment

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

This does not fix #185 (comment) . It will just skip over this condition until it reaches copyFileInfo and errors there because the path does not exist.

Copy link
Member Author

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

None yet

4 participants