-
Notifications
You must be signed in to change notification settings - Fork 775
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
Fixed an error when using the command to download src #2940
base: main
Are you sure you want to change the base?
Conversation
issue: fission#2938 Signed-off-by: waitstory <waitstory@163.com>
Sweep: PR ReviewSweep has finished reviewing your pull request. pkg/fission-cli/cmd/package/util/util.goThe changes import the Potential Issues
fission/pkg/fission-cli/cmd/package/util/util.go Lines 221 to 222 in f3c033f
|
Just following golang/go#41487 so see if there is better way to handle this issue. |
There seems to be no direct solution to the problem |
@@ -217,7 +218,8 @@ func WriteArchiveToFile(fileName string, reader io.Reader) error { | |||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we can just make this function simple without using rename or mv and getting rid of the temp file.
func WriteArchiveToFile(fileName string, reader io.Reader) error {
// Create the target file directly
file, err := os.Create(fileName)
if err != nil {
return err
}
defer file.Close()
// Copy data from the reader to the target file
_, err = io.Copy(file, reader)
if err != nil {
return err
}
// Change the permissions of the target file
err = os.Chmod(fileName, 0644)
if err != nil {
return err
}
return nil
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a good idea
@waitstory Would you like to make the above change or should I raise a separate PR? |
Let me make the change and submit it |
issue: fission#2938 Signed-off-by: waitstory <waitstory@163.com>
issue: #2938
Description
Fixed an error when using the command to download src
Which issue(s) this PR fixes:
Fixes #2938
Testing
Checklist: