diff --git a/examples/hello_schema/main.go b/examples/hello_schema/main.go index f4a4b92d4..e3fe2f1a3 100644 --- a/examples/hello_schema/main.go +++ b/examples/hello_schema/main.go @@ -57,16 +57,17 @@ func main() { } // File for your new BoltDB. Use path to regular file and not temporary in the real world - tmpfile, err := ioutil.TempFile("", "example") + tmpdir, err := ioutil.TempDir("", "example") checkErr(err) - defer os.Remove(tmpfile.Name()) // clean up + defer os.RemoveAll(tmpdir) // clean up // Initialize the database - graph.InitQuadStore("bolt", tmpfile.Name(), nil) + err = graph.InitQuadStore("bolt", tmpdir, nil) + checkErr(err) // Open and use the database - store, err := cayley.NewGraph("bolt", tmpfile.Name(), nil) + store, err := cayley.NewGraph("bolt", tmpdir, nil) checkErr(err) defer store.Close() qw := graph.NewWriter(store)