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

Add support for embed directories #71

Closed
4k1k0 opened this issue Dec 11, 2021 · 5 comments · Fixed by #108
Closed

Add support for embed directories #71

4k1k0 opened this issue Dec 11, 2021 · 5 comments · Fixed by #108
Assignees

Comments

@4k1k0
Copy link

4k1k0 commented Dec 11, 2021

It would be super useful if this package could copy embed directories.

For example:

Given the following fs tree:

/
  /assets
    /foo
       foo.txt
       bar.txt
    hello.txt
    goodbye.txt
  main.go

It could use the embed FS to use the copy function.

//go:embed assets
var assets embed.FS

func foo() error {
  file, err := assets.Open("assets")
  if err != nil {
    return err
  }

  err := Copy(file, "destination")
  if err != nil {
    return err
  }
  return nil
}

Or maybe use the Option structure

opt := Options{
	FS: assets,
}
err := Copy("assets/foo", "new/destination", opt)
@otiai10
Copy link
Owner

otiai10 commented Dec 15, 2021

Thank you for your feedback. Let me take time to think of it

@otiai10 otiai10 self-assigned this Dec 15, 2021
@otiai10
Copy link
Owner

otiai10 commented Jan 19, 2022

@tomaswarynyca
Copy link

@otiai10 is this planned to be implemented?

@otiai10
Copy link
Owner

otiai10 commented Jun 15, 2023

will tackle it this weekend ;)

otiai10 added a commit that referenced this issue Jun 18, 2023
@otiai10
Copy link
Owner

otiai10 commented Jun 18, 2023

See v1.12.0

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