ZipFS using testing/fstest#MapFS

138 views
Skip to first unread message

Tamás Gulácsi

unread,
Mar 24, 2022, 1:54:04 PM3/24/22
to golang-nuts
Hi,

I'd like to thank The Google Authors for https://pkg.go.dev/testing/fstest#MapFS - it just needed a very little tweaking to serve as a zip-backed fs.FS: https://pkg.go.dev/github.com/tgulacsi/go/zipfs.

The filenames, (missing) directory names in then zip.Reader.File slice gave me quite substantial bugs, so after using testing/fstest and staring at the bugs reported, it hit me:
fstest.MapFS is _almost_ the same as what I need.

Looking into the implementation, that filename/path fiddling, the synthetization of missing directories is far from simple, so the easiest was to just copy it as-is.

Is the included comment enough, and can it be used under Apache-2.0 license, or should I keep the BSD license for this code?
https://github.com/tgulacsi/go/blob/v0.19.7/zipfs/zipfs.go#L64-L70


Thanks,
Tamás Gulácsi

Ian Lance Taylor

unread,
Mar 24, 2022, 4:13:40 PM3/24/22
to Tamás Gulácsi, golang-nuts
The note you included is fine as long as there is a copy of the Go
LICENSE file in the LICENSE file in your repo. Enjoy.

Ian
Reply all
Reply to author
Forward
0 new messages