Skip to content

Input format question: final newline? #140

Closed
@mkfmnn

Description

@mkfmnn

I saw my day1 solution panicked with an error in the parsing code when run by the GitHub action: https://github.com/CodSpeedHQ/Advent/actions/runs/12124386193/job/33802001005

I do know that my code made some assumptions about the input based on the input file that I got from the AoC website (for instance that each line consists of two 5 digit numbers separated by 3 spaces) which could have triggered the panic. However, looking at the leaderboard, the top submissions made similar assumptions.

I did successfully test my code against the rust-runner tool as described in the README. I think one thing that could have triggered the error in the code for me is if the input file supplied to the code when run in the GitHub action is missing the final newline on the last line. Could you confirm whether this is the case?

Looking through the runs I did find another one that looks like it could have failed for the same reason. A few successful solutions that I spot-checked don't seem to care about whether the final line is properly terminated or not (either because they use lines() to split the input, or because they hard-code that the input has exactly 1000 lines).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions