Skip to content

Commit 8333d17

Browse files
knktc王智勇
andauthored
Add support for symlink in package command (#120)
* Add support for symbolic links in package command * Refactor symlink handling in package command * Improve comment clarity for symlink handling in package command --------- Co-authored-by: 王智勇 <tomwang@yunify.com>
1 parent b8e30a3 commit 8333d17

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

cmd/package.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ func (o *packageOptions) packageCmd(_ *cobra.Command, args []string) error {
4747
}
4848
defer os.RemoveAll(tempDir) // nolint
4949

50-
if err = copy.Copy(p, tempDir); err != nil {
50+
// Configure copy to follow symlinks and copy their target content
51+
opt := copy.Options{
52+
OnSymlink: func(_ string) copy.SymlinkAction {
53+
return copy.Deep
54+
},
55+
}
56+
if err = copy.Copy(p, tempDir, opt); err != nil {
5157
return err
5258
}
5359

0 commit comments

Comments
 (0)