#Tally Exercise on Golang track

25 messages · Page 1 of 1 (latest)

sullen slate
#
        Devastating Donkeys            |  3 |  2 |  1 |  0 |  7
        Allegoric Alaskians            |  3 |  2 |  0 |  1 |  6
        Blithering Badgers             |  3 |  1 |  0 |  2 |  3
        Courageous Californians        |  3 |  0 |  1 |  2 |  1
        want: Team                           | MP |  W |  D |  L |  P
        Devastating Donkeys            |  3 |  2 |  1 |  0 |  7
        Allegoric Alaskians            |  3 |  2 |  0 |  1 |  6
        Blithering Badgers             |  3 |  1 |  0 |  2 |  3
        Courageous Californians        |  3 |  0 |  1 |  2 |  1```

what am i doing wrong here? they both look same to me but the test still keeps failing 😦
sharp wharf
#

You can try dumping both into files and using a diff tool. I'm not at a computer right now to do that myself easily.

sullen slate
#

i did that as well

#

no difference

sharp wharf
#

Is it all the tests or just one? Is there a trailing newline?

sullen slate
#

all of them, no there isn't

sharp wharf
#

Offhand I'm not sure. Maybe someone else will spot something. It might be helpful to also share your code

sullen slate
#

its too big for discord

sharp wharf
#

Discord lets you attach larger snippets. Just hit the + button on the left of the input box

#

I think your output doesn't have a newline at the end. I have no idea if the test expects a trailing newline but you can try adding that.
Not related to the issue, you may also want to look into strings.Builder

#

See if adding a newline at the end helps

sullen slate
#

i replaced the byte buffer with string builder

sullen slate
#
Got:
Team                           | MP |  W |  D |  L |  P
Allegoric Alaskians            |  3 |  2 |  1 |  0 |  7
Courageous Californians        |  3 |  2 |  1 |  0 |  7
Blithering Badgers             |  3 |  0 |  1 |  2 |  1
Devastating Donkeys            |  3 |  0 |  1 |  2 |  1
------------------------------------------
Want:
Team                           | MP |  W |  D |  L |  P
Allegoric Alaskians            |  3 |  2 |  1 |  0 |  7
Courageous Californians        |  3 |  2 |  1 |  0 |  7
Blithering Badgers             |  3 |  0 |  1 |  2 |  1
Devastating Donkeys            |  3 |  0 |  1 |  2 |  1

in a text file

#

is there anything in go which would make a two strings containing same data to not be equal?

sullen slate
#

hmm looking at the bytes slice the expected byte slice has an extra '10' at the end

#

.....32 32 49 32 124 32 32 50 32 124 32 32 49 10]

#

this is how my byte slice looks

#

....32 124 32 32 49 32 124 32 32 50 32 124 32 32 49]

#

everythig else is same except the extra '10' any idea where that is coming from?

sharp wharf
#

10 is \n

sullen slate
#

Finally!!🙏🏻