# README
sandbox
Go library to create & manage lightweight sandboxes (like temporary files).
Requirements
- Go >= 1.10
Installation
This is a pure library, there is no associated command..
Installation is like many Go libraries with a simple
go get github.com/keltia/sandbox
sandbox
also has vgo
support & metadata (see the articles on vgo). It respects the Semantic Versioning principle with tagged releases.
You can thus use
vgo install github.com/keltia/sandbox
to install the library.
API Usage
snd, err := sandbox.New("foo")
if err != nil {
log.Fatalf("can not create sandbox: %v", err)
}
defer snd.Cleanup()
err := snd.Enter()
fmt.Println("Inside sandbox")
err := snd.Exit()
You can also sandbox a single func
with Run()
:
err := snd.Run(func() error {
fmt.Printf("I am in %d", snd.Cwd())
})
License
This is under the 2-Clause BSD license, see LICENSE.md
.
History
I originally wrote this code for various projects of mine and have re-used it enough time to think about putting it into its own module.
Contributing
Please see CONTRIBUTING.md for some simple rules.