From d75f7054336954c88a1c00ba971b2ba5845a8991 Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Wed, 16 Mar 2022 09:37:01 -0700 Subject: [PATCH] Normalize paths coming from ls tree --- cli/internal/fs/package_deps_hash.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cli/internal/fs/package_deps_hash.go b/cli/internal/fs/package_deps_hash.go index c26bb871321b4..a8c75fa109019 100644 --- a/cli/internal/fs/package_deps_hash.go +++ b/cli/internal/fs/package_deps_hash.go @@ -62,14 +62,20 @@ func GetPackageDeps(p *PackageDepsOptions) (map[string]string, error) { filesToHash = append(filesToHash, filepath.Join(p.PackagePath, filename)) } } + normalized := make(map[string]string) + // These paths are platform-dependent, but already relative to the package root + for platformSpecificPath, hash := range result { + platformIndependentPath := filepath.ToSlash(platformSpecificPath) + normalized[platformIndependentPath] = hash + } hashes, err := GetHashableDeps(filesToHash, p.PackagePath) if err != nil { return nil, err } - for key, hash := range hashes { - result[key] = hash + for platformIndependentPath, hash := range hashes { + normalized[platformIndependentPath] = hash } - return result, nil + return normalized, nil } // GetHashableDeps hashes the list of given files, then returns a map of normalized path to hash