-
Notifications
You must be signed in to change notification settings - Fork 881
chore(coderd): extract fileszip to its own package for reuse #15229
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
Conversation
func TestTarFileBytes() []byte { | ||
return append([]byte{}, testTarFileBytes...) | ||
} | ||
|
||
func TestZipFileBytes() []byte { | ||
return append([]byte{}, testZipFileBytes...) | ||
} |
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.
review: returning a clone of the byte to avoid accidental mutation in tests
//go:embed testdata/test.tar | ||
var testTarFileBytes []byte | ||
|
||
//go:embed testdata/test.zip | ||
var testZipFileBytes []byte |
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.
review: I chose to go:embed
these so that we don't end up with silly path errors.
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.
Minor nits but otherwise LGTM.
Related to #15087
As part of sniffing the workspace tags from an uploaded file, we need to be able to handle both zip and tar files. Extracting the functions in the
fileszip
package will be helpful here.