Merge pull request #121 from niklashhh/fix-recursive-symlinker

Fix symlink builder to recursively walk the vendor directory
This commit is contained in:
Jörg Thalheim 2024-05-30 08:32:35 +02:00 committed by GitHub
commit 31b6d2e40b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -91,19 +91,8 @@ func populateVendorPath(vendorPath string, src string) {
innerSrc := filepath.Join(src, f.Name())
dst := filepath.Join(vendorPath, f.Name())
if err := os.Symlink(innerSrc, dst); err != nil {
// assume it's an existing directory, try to link the directory content instead.
// TODO should we do this recursively?
files, err := os.ReadDir(innerSrc)
if err != nil {
panic(err)
}
for _, f := range files {
srcFile := filepath.Join(innerSrc, f.Name())
dstFile := filepath.Join(dst, f.Name())
if err := os.Symlink(srcFile, dstFile); err != nil {
fmt.Println("ignoring symlink error", srcFile, dstFile)
}
}
fmt.Println("symlink error, trying", innerSrc, err)
populateVendorPath(dst, innerSrc);
}
}
}