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

go prefixedwriter: fix short write error case #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jun 30, 2023

  1. go prefixedwriter: fix short write error case

    In certain cases, formatting as JSON actually reduces the number of bytes.
    This leads to the bufio.Writer that wraps this returning `short write` error
    because the number of bytes returned is less than expected.
    
    We just want to return the original number of bytes, since we know that we are
    doing some string manipulation and we are OK with that.
    
    See: https://pkg.go.dev/io#Writer
    ```
    Write writes len(p) bytes from p to the underlying data stream. It returns the
    number of bytes written from p (0 <= n <= len(p)) and any error encountered
    that caused the write to stop early. Write must return a non-nil error if it
    returns n < len(p).
    ```
    ChenJesse committed Jun 30, 2023
    Configuration menu
    Copy the full SHA
    981a12a View commit details
    Browse the repository at this point in the history