go-slug

Package go-slug
offers functions for packing and unpacking Terraform Enterprise
compatible slugs. Slugs are gzip compressed tar files containing Terraform configuration files.
Installation
Installation can be done with a normal go get
:
go get -u github.com/hashicorp/go-slug
Documentation
For the complete usage of go-slug
, see the full package docs.
Example
Packing or unpacking a slug is pretty straight forward as shown in the
following example:
package main
import (
"bytes"
"io/ioutil"
"log"
"os"
slug "github.com/hashicorp/go-slug"
)
func main() {
buf := bytes.NewBuffer(nil)
if _, err := slug.Pack("testdata/archive-dir", buf, false); err != nil {
log.Fatal(err)
}
dst, err := ioutil.TempDir("", "slug")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(dst)
if err := slug.Unpack(buf, dst); err != nil {
log.Fatal(err)
}
}
Issues and Contributing
If you find an issue with this package, please report an issue. If you'd like,
we welcome any contributions. Fork this repository and submit a pull request.