TAR libraries for Go
Go’s standard library package archive/tar reads ustar, pax and GNU archives and writes whichever of them an entry needs. Combine it with compress/gzip or compress/bzip2 (read only) from the standard library. For .tar.xz use github.com/ulikunitz/xz and for .tar.zst github.com/klauspost/compress/zstd: both give an io.Reader / io.Writer that archive/tar reads from or writes to.
- archive/tar Go's standard archive/tar package reads and writes TAR files. How to list, extract safely and create .tar and .tar.gz archives in Go, with code examples.