Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 4 commits into from
Oct 25, 2024

Conversation

johnstcn
Copy link
Member

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.

@johnstcn johnstcn self-assigned this Oct 25, 2024
Comment on lines 22 to 28
func TestTarFileBytes() []byte {
return append([]byte{}, testTarFileBytes...)
}

func TestZipFileBytes() []byte {
return append([]byte{}, testZipFileBytes...)
}
Copy link
Member Author

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

Comment on lines 16 to 20
//go:embed testdata/test.tar
var testTarFileBytes []byte

//go:embed testdata/test.zip
var testZipFileBytes []byte
Copy link
Member Author

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.

@johnstcn johnstcn requested review from mafredri and defelmnq October 25, 2024 12:01
Copy link
Member

@mafredri mafredri left a 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.

@johnstcn johnstcn merged commit df34858 into main Oct 25, 2024
26 checks passed
@johnstcn johnstcn deleted the cj/extract-pkg-fileszip branch October 25, 2024 14:14
@github-actions github-actions bot locked and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants