opencontainers / umoci

umoci modifies Open Container images
https://umo.ci
Apache License 2.0
744 stars 98 forks source link

*: migrate to Go stdlib error wrapping #556

Closed cyphar closed 2 days ago

cyphar commented 4 days ago

Fixes #388

cyphar commented 4 days ago

Yeah, it turns out depending on the behaviour of errors.Wrap(nil, ...) was a bad idea... It might be a good idea to make our own wrapper for now to avoid too much pain, but making it a proper printf wrapper would require us to parse the format string...

codecov-commenter commented 3 days ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 32.98429% with 384 lines in your changes missing coverage. Please review.

Project coverage is 72.43%. Comparing base (094e766) to head (e9fff47). Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
pkg/unpriv/unpriv.go 45.03% 52 Missing and 20 partials :warning:
oci/layer/tar_extract.go 18.33% 48 Missing and 1 partial :warning:
oci/cas/dir/dir.go 35.08% 34 Missing and 3 partials :warning:
oci/layer/unpack.go 20.51% 28 Missing and 3 partials :warning:
mutate/mutate.go 9.09% 20 Missing :warning:
oci/layer/tar_generate.go 16.66% 19 Missing and 1 partial :warning:
cmd/umoci/config.go 21.73% 18 Missing :warning:
utils.go 14.28% 16 Missing and 2 partials :warning:
cmd/umoci/raw-add-layer.go 33.33% 10 Missing :warning:
oci/casext/refname.go 10.00% 9 Missing :warning:
... and 23 more

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/opencontainers/umoci/pull/556/graphs/tree.svg?width=650&height=150&src=pr&token=f3YupAtrEk&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers)](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers) ```diff @@ Coverage Diff @@ ## main #556 +/- ## =========================================== + Coverage 46.49% 72.43% +25.94% =========================================== Files 60 60 Lines 4906 4985 +79 =========================================== + Hits 2281 3611 +1330 + Misses 2358 1000 -1358 - Partials 267 374 +107 ``` | [Files with missing lines](https://app.codecov.io/gh/opencontainers/umoci/pull/556?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers) | Coverage Δ | | |---|---|---| | [api.go](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&filepath=api.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers#diff-YXBpLmdv) | `100.00% <100.00%> (ø)` | | | [cmd/umoci/new.go](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&filepath=cmd%2Fumoci%2Fnew.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers#diff-Y21kL3Vtb2NpL25ldy5nbw==) | `91.78% <100.00%> (+91.78%)` | :arrow_up: | | [pkg/hardening/verified\_reader.go](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&filepath=pkg%2Fhardening%2Fverified_reader.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers#diff-cGtnL2hhcmRlbmluZy92ZXJpZmllZF9yZWFkZXIuZ28=) | `83.51% <100.00%> (ø)` | | | [pkg/idtools/idtools.go](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&filepath=pkg%2Fidtools%2Fidtools.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers#diff-cGtnL2lkdG9vbHMvaWR0b29scy5nbw==) | `100.00% <100.00%> (ø)` | | | [cmd/umoci/init.go](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&filepath=cmd%2Fumoci%2Finit.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers#diff-Y21kL3Vtb2NpL2luaXQuZ28=) | `83.33% <75.00%> (+83.33%)` | :arrow_up: | | [cmd/umoci/unpack.go](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&filepath=cmd%2Fumoci%2Funpack.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers#diff-Y21kL3Vtb2NpL3VucGFjay5nbw==) | `73.97% <66.66%> (+73.97%)` | :arrow_up: | | [oci/casext/json.go](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&filepath=oci%2Fcasext%2Fjson.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers#diff-b2NpL2Nhc2V4dC9qc29uLmdv) | `50.00% <0.00%> (ø)` | | | [oci/config/convert/default.go](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&filepath=oci%2Fconfig%2Fconvert%2Fdefault.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers#diff-b2NpL2NvbmZpZy9jb252ZXJ0L2RlZmF1bHQuZ28=) | `98.55% <0.00%> (ø)` | | | [oci/config/generate/save.go](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&filepath=oci%2Fconfig%2Fgenerate%2Fsave.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers#diff-b2NpL2NvbmZpZy9nZW5lcmF0ZS9zYXZlLmdv) | `78.57% <0.00%> (ø)` | | | [cmd/umoci/utils\_ux.go](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree&filepath=cmd%2Fumoci%2Futils_ux.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers#diff-Y21kL3Vtb2NpL3V0aWxzX3V4Lmdv) | `93.28% <75.00%> (+58.38%)` | :arrow_up: | | ... and [27 more](https://app.codecov.io/gh/opencontainers/umoci/pull/556?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers) | | ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/opencontainers/umoci/pull/556/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opencontainers)
cyphar commented 3 days ago

This patchset adds and removes pkg/fmtcompat. I think that it makes it easier to review, so I think it makes sense to keep it (otherwise you would need to do everything in one big patch or rework things in a somewhat unnatural way, otherwise you'll end up with broken commits if you bisect).