Go for Embedded Systems and IoT

Use the archive/zip package to read and write ZIP files in Go, handling security checks via GODEBUG.

The archive/zip package in Go provides functions to read and write ZIP archives, with security checks controlled by the GODEBUG environment variable. To open a ZIP file, use zip.OpenReader which returns a *zip.ReadCloser that must be closed after use. If the archive contains insecure paths (non-local names or backslashes) and GODEBUG=zipinsecurepath=0 is set, the function returns zip.ErrInsecurePath.

import "archive/zip"

r, err := zip.OpenReader("archive.zip")
if err != nil {
    // handle error
}
defer r.Close()

for _, f := range r.File {
    // process file f
}