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

Adding ioutil.TempDir support to make unique temp directories #2

Closed
wants to merge 3 commits into from

Conversation

nicknezis
Copy link
Contributor

No description provided.

@joelanford
Copy link
Owner

There's actually some complications with this change. The creation of the directory is happening in the scratch.Setup() function for non-ramdisk stuff and in the ramdisk-specific attach or mount functions when ramdisk is enabled. So that needs to be cleaned up.

I also noticed that I'm not always checking to make sure that the directory does not exist before creating it. That part is important. It tells me its safe to delete it when I'm done, because there shouldn't be any other user files in there.

I'm thinking we could just pass the scratchSpaceDir option directly into scratch.New() without modification and then cleanup the scratch.Setup function to handle the creation of that directory in just one place. If that option is an empty string, we just use ioutil.TempDir("/tmp", "goscan") and if not, we check that whatever was passed in doesn't exist and then create it.

Then the only other thing to worry about is that the filescanner.Opts needs to know what that directory is, so we would need to make a new function on Scratch to return the directory created after Setup is called.

…n the proper place. Also some minor cleanup.
@nicknezis
Copy link
Contributor Author

Replacing with this: #3

Basically squashed the commits and removed a merge done by mistake.

@nicknezis nicknezis closed this Feb 8, 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