Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hello_schema: replace TempFile with TempDir #707

Merged
merged 1 commit into from
Apr 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions examples/hello_schema/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down