]> Sergey Matveev's repositories - btrtrc.git/blobdiff - example_test.go
Drop support for go 1.20
[btrtrc.git] / example_test.go
index 9dc7502c314afaf5e0c7c9b75c9dec64aa00c51d..54cb7190689081ac8020a24aeca054897a79ce13 100644 (file)
@@ -1,7 +1,6 @@
 package torrent_test
 
 import (
-       "io"
        "log"
 
        "github.com/anacrolix/torrent"
@@ -18,13 +17,9 @@ func Example() {
 }
 
 func Example_fileReader() {
-       var (
-               t torrent.Torrent
-               f torrent.File
-       )
-       r := t.NewReader()
-       defer r.Close()
-       // Access the parts of the torrent pertaining to f. Data will be
+       var f torrent.File
+       // Accesses the parts of the torrent pertaining to f. Data will be
        // downloaded as required, per the configuration of the torrent.Reader.
-       _ = io.NewSectionReader(r, f.Offset(), f.Length())
+       r := f.NewReader()
+       defer r.Close()
 }