How sanderhahn/gozip works
Project type and purpose
• This is a Go-based command-line tool plus library (“gozip”) for creating, listing, and extracting ZIP archives, with the special ability to embed ZIP payloads behind an executable.
• It exports three core functions (Zip, UnzipList, Unzip) and provides a cmd/gozip binary as the CLI front-end.
File structure
• Top-level:
• gozip.go & gozip_test.go – the library implementation and tests
• cmd/gozip/main.go – CLI entry point
• go.mod – module definition
• readme.md & LICENSE.txt – documentation and license
• No additional services or microservices—just a simple library + CLI.
README
• Describes API functions and usage patterns
• Shows the “self-extracting binary” use case where ZIP data is appended to the executable
• No external dependencies beyond Go’s standard library (archive/zip, os, etc.)
Main components
a. CLI Binary (cmd/gozip)
b. gozip Library (core package)
c. Go’s Standard Library (archive/zip, io, os)
d. File System / OS Layer
e. ZIP Payload (on-disk .zip or embedded behind binary)
f. User / Shell (invoking the CLI)
Relationships and data flows
• User types a command → Shell invokes CLI binary
• CLI binary → parses flags and arguments → calls gozip library functions
• Library → uses Go’s archive/zip and os packages → reads/writes ZIP payload
• File system → stores/reads .zip files or extracts files into directories
• Self-extracting mode: library locates the ZIP header offset within the binary and treats the remaining bytes as the archive.
Architectural patterns and design principles
• Clear separation of concerns: CLI (presentation) vs. core library (business logic)
• Reusability: library can be imported by other Go programs
• Single-binary distribution: embedding ZIP data behind executables
• Minimal external dependencies, leaning on Go’s standard library