Archives are a file format that stores multiple files. Two of the most common archive formats are tar balls ZIP archives. The Go standard library has both the tar and zip packages. These examples use the ZIP format, but the tar format can easily be interchanged.
Archives
Archive (ZIP) files
The following example demonstrates how to create an archive with multiple files inside. The files in the example are hard-coded with only a few bytes, but should be easily adapted to suit other needs:
// This example uses zip but standard library // also supports tar archives package main import ( "archive/zip" "log" "os" ) func main() { // Create a file to write the archive buffer...