#OW9 weird formatting test failure

I’m stuck on Stage #OW9 with golang

I’m pretty sure I got the solution right (GitHub - CoderFrogger/OW9)
But when I run the tests I get an error

Here are my logs:

[tester::#OW9] Running tests for Stage #OW9 (Parse torrent file)
[tester::#OW9] Running ./your_bittorrent.sh info /tmp/torrents3719957302/itsworking.gif.torrent
[your_program] Tracker URL: http://bittorrent-test-tracker.codecrafters.io/announce
[your_program] Length : 2549700
[tester::#OW9] Checking for tracker URL (Tracker URL: http://bittorrent-test-tracker.codecrafters.io/announce)
[tester::#OW9] Tracker URL is correct
[tester::#OW9] Checking for length (Length: 2549700)
[tester::#OW9] Expected stdout to contain "Length: 2549700", got: "Tracker URL: http://bittorrent-test-tracker.codecrafters.io/announce\nLength : 2549700\n"
[tester::#OW9] Test failed

At first I thought my output might be the culprit since I used \n

fmt.Printf("Tracker URL: %v\n", decodedFile["announce"])
fmt.Printf("Length : %v\n", downloadLength["length"])

But even when I changed it to fmt.Println() the issue persists.

I tried downloading the test torrent files and my app runs with them with no issues

Hi CoderFrogger,
It’s because of an extra space after Length
Try Length: 2549700 instead of Length : 2549700

2 Likes

Not the first time the answer was staring me right in the face. Thank you lots

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.