You could have the outer function do something like this?
```
root, err := ioutil.TempDir()
...
defer os.removeAll(root)
ctx := b.getContext(root)
```