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

returns EOF error when unpack textfile #18

Open
yogihardi opened this issue Dec 27, 2022 · 0 comments
Open

returns EOF error when unpack textfile #18

yogihardi opened this issue Dec 27, 2022 · 0 comments

Comments

@yogihardi
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.17.6 darwin/amd64

What did you do?

unpack textfile with the following code:

	tmpFile, err := ioutil.TempFile(os.TempDir(), "")
	if err != nil {
		log.Fatal("Cannot create temporary file", err)
	}

	// Remember to clean up the file afterwards
	defer os.Remove(tmpFile.Name())

	// Example writing to the file
	text := []byte("lorem ipsum")
	if _, err = tmpFile.Write(text); err != nil {
		log.Fatal("Failed to write to temporary file", err)
	}
	tmpFile.Close()

	fileToProcess := tmpFile.Name()
	fOpen, err := os.Open(fileToProcess)
	if err != nil {
		log.Fatal(err)
	}
	defer fOpen.Close()

	_, err = unpackit.Unpack(fOpen, "/tmp/unpackit")
	if err != nil {
		log.Fatal(err)
	}

What did you expect to see?

proper error message, ie: unsupported file

What did you see instead?

EOF error

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

No branches or pull requests

1 participant