Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ld
go-car
Commits
326783fe
Commit
326783fe
authored
Jul 20, 2021
by
Masih H. Derkani
Committed by
Masih H. Derkani
Jul 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `ioutil.TempFile` to simplify file creation in index example
Use existing SDK to create temp file in index example.
parent
c3a59556
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
7 deletions
+1
-7
v2/index/example_test.go
v2/index/example_test.go
+1
-7
No files found.
v2/index/example_test.go
View file @
326783fe
...
...
@@ -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
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment