diff --git a/v2/index/example_test.go b/v2/index/example_test.go index 507046207459fb24a95914a6910fb2f78c1b3f18..ca0ac73ab90837f510f91723f216f58556ce9c97 100644 --- a/v2/index/example_test.go +++ b/v2/index/example_test.go @@ -5,7 +5,6 @@ import ( "io" "io/ioutil" "os" - "path/filepath" "reflect" carv2 "github.com/ipld/go-car/v2" @@ -69,12 +68,7 @@ func ExampleWriteTo() { } // Store the index alone onto destination file. - tdir, err := ioutil.TempDir(os.TempDir(), "example-*") - if err != nil { - panic(err) - } - dst := filepath.Join(tdir, "index.carindex") - f, err := os.Create(dst) + f, err := ioutil.TempFile(os.TempDir(), "example-index-*.carindex") if err != nil { panic(err) }