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

Remove temporary directory flag #3087

Open
phillebaba opened this issue Oct 9, 2024 · 0 comments
Open

Remove temporary directory flag #3087

phillebaba opened this issue Oct 9, 2024 · 0 comments

Comments

@phillebaba
Copy link
Member

Describe what should be investigated or refactored

Currently we have a --tmpdir flag in the root command. This allows users to set a custom directory to use for their temp directory.

Using this flag requires use to pass the configured flag every time we want to create a temporary directory.

tmp, err := utils.MakeTempDir(config.CommonOptions.TempDirectory)

There is already a standard to override the temporary directory used by go when creating a new directory.

On Unix systems, it returns $TMPDIR if non-empty, else /tmp.
On Windows, it uses GetTempPath, returning the first non-empty value from %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory.

We should remove the flag and tell people to use these environment variables instead if they want to override the temp directory. We should also remove use to the helpers function to create the temporary directory in favor of stdlib.

Links to any relevant code

rootCmd.PersistentFlags().StringVar(&config.CommonOptions.TempDirectory, "tmpdir", v.GetString(common.VTmpDir), lang.RootCmdFlagTempDir)

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

No branches or pull requests

2 participants