Our Zip function in zip/zip.go:Zip relies on https://pkg.go.dev/path/filepath#WalkDir which doesn't follow symlinks.
This causes issues with monorepos where local dependencies are symlinked in node_modules.
Since the symlink cannot be resolved, the build process fails during zip creation.
What is this PR solving
This PR is meant to enable our zip/zip.go:Zip function to follow symlinks, properly resolve them and add the files in the symlinked dirs to the output zip.
How is this PR solving it
It is adding a new method walkSymlink(writer *zip.Writer, files *[]string, path string, destBasePath string) error which firs evaluates symlinked dir passed as the path argument and then continues with the resolved dir in the same way as the filepath.WalkDir function behaved in our Zip function.
Context
Our Zip function in
zip/zip.go:Zip
relies on https://pkg.go.dev/path/filepath#WalkDir which doesn't follow symlinks. This causes issues with monorepos where local dependencies are symlinked innode_modules
. Since the symlink cannot be resolved, the build process fails during zip creation.What is this PR solving
This PR is meant to enable our
zip/zip.go:Zip
function to follow symlinks, properly resolve them and add the files in the symlinked dirs to the output zip.How is this PR solving it
It is adding a new method
walkSymlink(writer *zip.Writer, files *[]string, path string, destBasePath string) error
which firs evaluates symlinked dir passed as thepath
argument and then continues with the resolved dir in the same way as thefilepath.WalkDir
function behaved in ourZip
function.