Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend/dockerfile: BFlags.Parse: include flag with "--" prefix in errors #5369

Merged
merged 2 commits into from
Oct 1, 2024

Commits on Sep 30, 2024

  1. frontend/dockerfile: BFlags.Parse: return earlier on "--" terminator

    Minor optimization; put the check for a literal "--" first, instead of
    matching for "--" as prefix. Also add some documentation to the code,
    to outline why we return early.
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    b300989 View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2024

  1. frontend/dockerfile: BFlags.Parse: include flag with "--" prefix in e…

    …rrors
    
    Before this change, only the name of the flag would be printed as part
    of errors. Change the errors to include the flag-name _including_ the
    "--" prefix to make it more clear the error is about a flag that was
    provided but invalid.
    
    Before this change:
    
        Dockerfile:2
        --------------------
        1 |     FROM alpine
        2 | >>> COPY --nosuchflag . .
        3 |
        --------------------
        ERROR: failed to solve: dockerfile parse error on line 2: unknown flag: nosuchflag
    
        Dockerfile:4
        --------------------
        2 |     FROM alpine
        3 |     WORKDIR /test
        4 | >>> COPY --exclude /.git . .
        5 |
        --------------------
        ERROR: failed to solve: dockerfile parse error on line 4: missing a value on flag: exclude
    
    With this change;
    
        Dockerfile:2
        --------------------
        1 |     FROM alpine
        2 | >>> COPY --nosuchflag . .
        3 |
        --------------------
        ERROR: failed to solve: dockerfile parse error on line 2: unknown flag: --nosuchflag
    
        Dockerfile:4
        --------------------
        2 |     FROM alpine
        3 |     WORKDIR /test
        4 | >>> COPY --exclude /.git . .
        5 |
        --------------------
        ERROR: failed to solve: dockerfile parse error on line 4: missing a value on flag: --exclude
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    31a7c17 View commit details
    Browse the repository at this point in the history