Skip to content

Commit

Permalink
add extension to temp file name
Browse files Browse the repository at this point in the history
Signed-off-by: Rajat Jindal <[email protected]>
  • Loading branch information
rajatjindal committed Jan 26, 2024
1 parent 7e665db commit 8eba351
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cmd/modify_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
_ "k8s.io/client-go/plugin/pkg/client/auth"
)

//Version is set during build time
// Version is set during build time
var Version = "unknown"

//ModifySecretOptions is struct for modify secret
// ModifySecretOptions is struct for modify secret
type ModifySecretOptions struct {
configFlags *genericclioptions.ConfigFlags
IOStreams genericclioptions.IOStreams
Expand Down Expand Up @@ -123,7 +123,7 @@ func (o *ModifySecretOptions) Run() error {
data[k] = string(v)
}

tempfile, err := ioutil.TempFile("", fmt.Sprintf("%s-%s-", o.namespace, o.secretName))
tempfile, err := os.CreateTemp("", fmt.Sprintf("%s-%s-*.yaml", o.namespace, o.secretName))
if err != nil {
return err
}
Expand All @@ -134,7 +134,7 @@ func (o *ModifySecretOptions) Run() error {
return err
}

err = ioutil.WriteFile(tempfile.Name(), yamlData, 0644)
err = os.WriteFile(tempfile.Name(), yamlData, 0644)
if err != nil {
return err
}
Expand Down

0 comments on commit 8eba351

Please sign in to comment.