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

Ignore non-problematic files in destination folder #3

Merged
merged 2 commits into from
Aug 5, 2017

Conversation

cmlicata
Copy link
Collaborator

@cmlicata cmlicata commented Apr 26, 2017

@inadarei, this addresses #1.

I also addressed the following, based upon the discussion surrounding the issue:

  • preserve any files that might otherwise be deleted or overwritten during the post-build 'clean-up' (e.g. README.md).
  • add .idea/ directory to .gitignore to address unnecessary generated files from jetbrains products like Gogland

if filesToMove != nil {
for _, file := range filesToMove {
srcPath := filepath.Join(path, file)
tmpFilePath := filepath.Join(os.TempDir(), file)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By using os.TempDir() directly, you will destroy any pre-existing files there which may have the same name(s) as the files you are stashing away. In extreme scenarios - you may run into even more severe conflicting cases.

Rather, let's make sure we create a unique folder under os.TempDir() and do our dirty work there.

if filesToMove != nil {
for _, file := range filesToMove {
srcPath := filepath.Join(path, file)
tmpFilePath := filepath.Join(os.TempDir(), file)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By naming this variable tmpFilePath (which was already used for a different purpose on line 64) you are causing confusion and possibility of conflict.

@inadarei
Copy link
Owner

inadarei commented Aug 5, 2017

This works as required, minus couple of minor issues. I fixed those issues and will be merging shortly. Thank you for your valuable contribution!

@inadarei inadarei merged commit 372add3 into inadarei:master Aug 5, 2017
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 this pull request may close these issues.

2 participants