Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow copying local directories instead of using symlinks #169

Open
laverya opened this issue Feb 25, 2019 · 2 comments · May be fixed by #478
Open

Allow copying local directories instead of using symlinks #169

laverya opened this issue Feb 25, 2019 · 2 comments · May be fixed by #478

Comments

@laverya
Copy link

laverya commented Feb 25, 2019

Sometimes, you really do just want a copy of the files, and not a symlink. For example, when you'll be editing the files that have just been go-gettered - as we do in replicatedhq/ship. Edits being reflected in the upstream files would be extremely unexpected behavior, and so true copies are needed.

@FlorianJDF
Copy link

Hello,

I have the same issue. I'm trying to create a full copy of the source folder to the destination path:

client := &getter.Client{
	Src:  sourceUrl,
	Dst:  destination,
	Pwd:  pwd,
	Mode: getter.ClientModeDir,
	Detectors: []getter.Detector{
		new(getter.FileDetector),
	},
	Getters: map[string]getter.Getter{
		"file": &getter.FileGetter{
			Copy: true,
		},
	},
}

err := client.Get()

But even with the Copy of the FileGetter to true I only have a symlink.

@mildred
Copy link

mildred commented Apr 30, 2021

I worked around it with a quick fix here, creating a custom getter:

https://github.com/mildred/terraform-provider-sys/tree/master/sys/file_getter

use is here:

https://github.com/mildred/terraform-provider-sys/blob/08ba7f0d2e5dd0377c8323e9c832ded4808b6515/sys/resource_file.go#L317-L337

I used a ready made folder copy algorithm, but ideally, it should be included in go-getter itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants