Skip to content

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Jul 19, 2021

There are two bugs being fixed:

  1. The hueristic for whether a slice of byte looks like text
    should check whether a rune IsPrint OR IsSpace, and not both.
    Only a single rune (i.e., U+0020) ever satisfies both conditions.

    Previously, it would print as:

    MyBytes{0x68, 0x65, 0x6c, 0x6c, 0x6f}
    

    and now it would now print as:

    MyBytes(MyBytes("hello"))
    
  2. If we're printing as string, then we should set skipType=true
    since we already explicitly format the value with the type.

    Previously, it would print as:

    MyBytes(MyBytes("hello"))
    

    and now it would now print as:

    MyBytes("hello")
    

There are two bugs being fixed:

1.  The hueristic for whether a slice of byte looks like text
    should check whether a rune IsPrint OR IsSpace, and not both.
    Only a single rune (i.e., U+0020) ever satisfies both conditions.

    Previously, it would print as:
        MyBytes{0x68, 0x65, 0x6c, 0x6c, 0x6f}
    and now it would now print as:
        MyBytes(MyBytes("hello"))

2.  If we're printing as string, then we should set skipType=true
    since we already explicitly format the value with the type.

    Previously, it would print as:
        MyBytes(MyBytes("hello"))
    and now it would now print as:
        MyBytes("hello")
@dsnet
Copy link
Collaborator Author

dsnet commented Jul 19, 2021

\cc @neild.

@neild neild merged commit 402949e into google:master Jul 19, 2021
@dsnet dsnet deleted the fix-format branch July 19, 2021 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants