-
Notifications
You must be signed in to change notification settings - Fork 18k
archive/tar: when uncompress the tar file, found io.Reader/io.Writer some problem but don't know reason #36176
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
Comments
In your snippet, there is a line that reads all bytes from the tar reader: cttBys, _ := ioutil.ReadAll(tr) The error value isn't check. Can you try adding something that checks if the error is non-nil and reports it? |
ioutil.WriteFile() also returns an error which should be checked. |
I tried to add the if hdr.Name == jenkins.RunDelLogFilename {
cttBys, er := ioutil.ReadAll(tr)
if er != nil{
fmt.Printf(" tar content read is fail, Error: %v\r\n", er.Error())
return
}
//~~
er = ioutil.WriteFile("./jc-test.log", cttBys, 0777)
if er != nil{
fmt.Printf(" ./jc-test.log, Error: %v\r\n", er.Error())
return
}
} |
What is the difference in the content exactly? Are you able to make a smaller self-contained sample that we can reproduce this problem with? That will help with understanding whether the problem is a bug in |
To simplify the diffrent that got the result by |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Content of
fmt.Println(cttStr)
and./jc-test.log
is same.What did you see instead?
Content of
fmt.Println(cttStr)
and./jc-test.log
is deffrent. So I can handler the real content.The text was updated successfully, but these errors were encountered: