How williamkoller/goarray works
Project Type and Purpose
• Open-source Go library (module) providing JavaScript-style array utilities via Go 1.18+ generics
• Core deliverable: arrayutils package (pure functions, immutable operations)
• Secondary deliverable: a demo CLI under cmd/demo showing example usage
File Structure Analysis
• Top-level
– go.mod: module declaration, dependency management
– LICENSE/README.md: docs and legal
• arrayutils/
– arrayutils.go: implementations of Map, Filter, Reduce, etc.
– arrayutils_test.go: unit tests and benchmarks
• cmd/demo/
– main.go: standalone program importing arrayutils for demonstration
Key Components
• Core Package: arrayutils
• Unit Tests & Benchmarks: validate and measure arrayutils
• Demo CLI: cmd/demo (imports arrayutils)
• Consumers: external Go programs or services that import github.com/williamkoller/goarray/arrayutils
• Go Toolchain: go build, go test, go bench
Relationships and Data Flow
• Consumers → import → Core Package
• Demo CLI → import → Core Package
• Unit Tests → import → Core Package
• Go Toolchain → invokes build/test/bench on Core Package and Demo CLI
Architectural Patterns & Design Principles
• Functional/Immutable: each utility is a pure function, returns new slices
• Generics-based Type Safety: func Map[T, R](…) []R
• Zero External Dependencies: only Go’s standard library
• Separation of Concerns:
– Library code vs tests vs examples
– Module boundary defined by go.mod
Essential Elements
• Clear labels for each component (package path, folder name)
• Call-outs for key technologies: Go generics, standard library only