mirror of
https://github.com/moby/buildkit.git
synced 2026-06-30 19:57:39 +00:00
chore: annotate errors returned from NewFromStat() with the file path
Otherwise it is very tricky to understand which file produced the error. Should help with https://github.com/docker/for-win/issues/14083 Signed-off-by: Alberto Garcia Hierro <damaso.hierro@docker.com>
This commit is contained in:
3
cache/contenthash/filehash.go
vendored
3
cache/contenthash/filehash.go
vendored
@@ -8,6 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
fstypes "github.com/tonistiigi/fsutil/types"
|
||||
)
|
||||
|
||||
@@ -46,7 +47,7 @@ func NewFromStat(stat *fstypes.Stat) (hash.Hash, error) {
|
||||
fi := &statInfo{stat}
|
||||
hdr, err := tar.FileInfoHeader(fi, stat.Linkname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrapf(err, "failed to checksum file %s", stat.Path)
|
||||
}
|
||||
hdr.Name = "" // note: empty name is different from current has in docker build. Name is added on recursive directory scan instead
|
||||
hdr.Devmajor = stat.Devmajor
|
||||
|
||||
Reference in New Issue
Block a user