<p dir="auto">The following program fails with the panic:</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package main

import (
    &quot;fmt&quot;
    &quot;net/mail&quot;
)

func main() {
    data := &quot;=??Q? ?=&lt;0@0&gt;&quot;
    addr, err := mail.ParseAddress(data)
    if err != nil {
        return
    }
    _, err = mail.ParseAddress(addr.String())
    if err != nil {
        fmt.Printf(&quot;failed to parse addr: %q -&gt; %q\n&quot;, data, addr)
        panic(err)
    }
}"><pre class="notranslate"><span class="pl-k">package</span> main

<span class="pl-k">import</span> (
    <span class="pl-s">"fmt"</span>
    <span class="pl-s">"net/mail"</span>
)

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-s1">data</span> <span class="pl-c1">:=</span> <span class="pl-s">"=??Q? ?=&lt;0@0&gt;"</span>
    <span class="pl-s1">addr</span>, <span class="pl-s1">err</span> <span class="pl-c1">:=</span> <span class="pl-s1">mail</span>.<span class="pl-en">ParseAddress</span>(<span class="pl-s1">data</span>)
    <span class="pl-k">if</span> <span class="pl-s1">err</span> <span class="pl-c1">!=</span> <span class="pl-c1">nil</span> {
        <span class="pl-k">return</span>
    }
    <span class="pl-s1">_</span>, <span class="pl-s1">err</span> <span class="pl-c1">=</span> <span class="pl-s1">mail</span>.<span class="pl-en">ParseAddress</span>(<span class="pl-s1">addr</span>.<span class="pl-en">String</span>())
    <span class="pl-k">if</span> <span class="pl-s1">err</span> <span class="pl-c1">!=</span> <span class="pl-c1">nil</span> {
        <span class="pl-s1">fmt</span>.<span class="pl-en">Printf</span>(<span class="pl-s">"failed to parse addr: %q -&gt; %q<span class="pl-cce">\n</span>"</span>, <span class="pl-s1">data</span>, <span class="pl-s1">addr</span>)
        <span class="pl-en">panic</span>(<span class="pl-s1">err</span>)
    }
}</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="failed to parse addr: &quot;=??Q? ?=&lt;0@0&gt;&quot; -&gt; &quot;\&quot;=??Q? ?=\&quot; &lt;0@0&gt;&quot;
panic: mail: missing word in phrase: charset not supported: &quot;&quot;"><pre class="notranslate"><code class="notranslate">failed to parse addr: "=??Q? ?=&lt;0@0&gt;" -&gt; "\"=??Q? ?=\" &lt;0@0&gt;"
panic: mail: missing word in phrase: charset not supported: ""
</code></pre></div>
<p dir="auto">That name should have been escaped.</p>
<p dir="auto">go version devel +514014c Thu Jun 18 15:54:35 2015 +0200 linux/amd64</p>
<p dir="auto">The following program fails the panic:</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package main

import (
    &quot;fmt&quot;
    &quot;net/mail&quot;
)

func main() {
    data := &quot;\&quot;\\\x1f,\&quot;&lt;0@0&gt;&quot;
    addr, err := mail.ParseAddress(data)
    if err != nil {
        return
    }
    _, err = mail.ParseAddress(addr.String())
    if err != nil {
        fmt.Printf(&quot;failed to parse addr: %q -&gt; %q\n&quot;, data, addr)
        panic(err)
    }
}"><pre class="notranslate"><span class="pl-k">package</span> main

<span class="pl-k">import</span> (
    <span class="pl-s">"fmt"</span>
    <span class="pl-s">"net/mail"</span>
)

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-s1">data</span> <span class="pl-c1">:=</span> <span class="pl-s">"<span class="pl-cce">\"</span><span class="pl-cce">\\</span><span class="pl-cce">\x1f</span>,<span class="pl-cce">\"</span>&lt;0@0&gt;"</span>
    <span class="pl-s1">addr</span>, <span class="pl-s1">err</span> <span class="pl-c1">:=</span> <span class="pl-s1">mail</span>.<span class="pl-en">ParseAddress</span>(<span class="pl-s1">data</span>)
    <span class="pl-k">if</span> <span class="pl-s1">err</span> <span class="pl-c1">!=</span> <span class="pl-c1">nil</span> {
        <span class="pl-k">return</span>
    }
    <span class="pl-s1">_</span>, <span class="pl-s1">err</span> <span class="pl-c1">=</span> <span class="pl-s1">mail</span>.<span class="pl-en">ParseAddress</span>(<span class="pl-s1">addr</span>.<span class="pl-en">String</span>())
    <span class="pl-k">if</span> <span class="pl-s1">err</span> <span class="pl-c1">!=</span> <span class="pl-c1">nil</span> {
        <span class="pl-s1">fmt</span>.<span class="pl-en">Printf</span>(<span class="pl-s">"failed to parse addr: %q -&gt; %q<span class="pl-cce">\n</span>"</span>, <span class="pl-s1">data</span>, <span class="pl-s1">addr</span>)
        <span class="pl-en">panic</span>(<span class="pl-s1">err</span>)
    }
}</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="failed to parse addr: &quot;\&quot;\\\x1f,\&quot;&lt;0@0&gt;&quot; -&gt; &quot;=?utf-8?q?=1F,?= &lt;0@0&gt;&quot;
panic: mail: no angle-addr"><pre class="notranslate"><code class="notranslate">failed to parse addr: "\"\\\x1f,\"&lt;0@0&gt;" -&gt; "=?utf-8?q?=1F,?= &lt;0@0&gt;"
panic: mail: no angle-addr
</code></pre></div>
<p dir="auto">ParseAddress must handle result of Address.String, or else first ParseAddress must fail.</p>
<p dir="auto">go version devel +514014c Thu Jun 18 15:54:35 2015 +0200 linux/amd64</p>