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

archive/zip: Header<->os.FileInfo functions #2186

Closed
mark-summerfield opened this issue Aug 25, 2011 · 10 comments
Closed

archive/zip: Header<->os.FileInfo functions #2186

mark-summerfield opened this issue Aug 25, 2011 · 10 comments
Assignees
Milestone

Comments

@mark-summerfield
Copy link

@mark-summerfield mark-summerfield commented Aug 25, 2011

The zip package has a FileHeader struct that uses the fields required by zip files.
Unfortunately these fields do not map nicely to os.FileInfo fields.

I think it would be helpful to provide conversion functions:

zip.HeaderForInfo(*os.FileInfo) *zip.FileHeader
zip.InfoForHeader(*zip.FileHeader) *.os.FileInfo

This would be particularly convenient when it comes to date/time and permissions
handling.

Similar functions would also be helpful (but not as necesary) in the tar package.
@mark-summerfield
Copy link
Author

@mark-summerfield mark-summerfield commented Aug 25, 2011

Comment 1:

Of course, even better would be *zip.FileHeader methods:
zip.FileHeader.FileInfo() *os.FileInfo
zip.FileHeader.Populate(*os.FileInfo)
@adg
Copy link
Contributor

@adg adg commented Sep 19, 2011

Comment 2:

Agree this would be very useful.

Owner changed to @adg.

Status changed to Accepted.

@rsc
Copy link
Contributor

@rsc rsc commented Sep 19, 2011

Comment 3:

The *For* names are not idiomatic.
It should be a FileInfo method on the zip file header.
@rsc
Copy link
Contributor

@rsc rsc commented Oct 6, 2011

Comment 4:

This will be partly addressed by FileInfo becoming an interface.
@rsc
Copy link
Contributor

@rsc rsc commented Dec 9, 2011

Comment 6:

Labels changed: added priority-later, removed priority-medium.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 9, 2011

Comment 7:

Labels changed: added priority-go1.

@robpike
Copy link
Contributor

@robpike robpike commented Jan 13, 2012

Comment 8:

Owner changed to builder@golang.org.

@rsc
Copy link
Contributor

@rsc rsc commented Jan 24, 2012

Comment 9:

Maybe
func (*Header) FileInfo() os.FileInfo
func FileInfoHeader(os.FileInfo) *Header
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jan 26, 2012

Comment 10:

Owner changed to @bradfitz.

Status changed to Started.

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jan 26, 2012

Comment 11:

This issue was closed by revision b62a509.

Status changed to Fixed.

@rsc rsc added this to the Go1 milestone Apr 10, 2015
@rsc rsc removed the priority-go1 label Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.