tweaks and fmt
This commit is contained in:
parent
8922de6783
commit
8baf937ecf
2 changed files with 4 additions and 3 deletions
|
@ -5,6 +5,7 @@ bittorrent related things
|
||||||
## ./bencode/
|
## ./bencode/
|
||||||
|
|
||||||
fork from code.google.com/p/bencode-go
|
fork from code.google.com/p/bencode-go
|
||||||
|
with a few changes
|
||||||
|
|
||||||
## ./torrent/
|
## ./torrent/
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@ func main() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(fh)
|
buf, err := ioutil.ReadAll(fh)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fh.Close()
|
fh.Close()
|
||||||
|
|
||||||
tf := torrent.File{}
|
tf := torrent.File{}
|
||||||
err = bencode.Unmarshal(buf, &tf)
|
err = bencode.Unmarshal(buf, &tf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||||
|
@ -54,7 +54,7 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||||
}
|
}
|
||||||
_, err = fhOutput.Write(buf)
|
_, err = fhOutput.Write(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue