<p dir="auto"><a href="http://play.golang.org/p/gmQEUKYxrG" rel="nofollow">http://play.golang.org/p/gmQEUKYxrG</a></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;
    t &quot;time&quot;
)

func main() {
    fmt.Println(&quot;Hello, playground&quot;)
    time.Sleep(time.Second)
}"><pre class="notranslate"><span class="pl-k">package</span> main

<span class="pl-k">import</span> (
    <span class="pl-s">"fmt"</span>
    t <span class="pl-s">"time"</span>
)

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-s1">fmt</span>.<span class="pl-en">Println</span>(<span class="pl-s">"Hello, playground"</span>)
    <span class="pl-s1">time</span>.<span class="pl-en">Sleep</span>(<span class="pl-s1">time</span>.<span class="pl-c1">Second</span>)
}</pre></div>
<p dir="auto">Run through imports, results in:</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;

func main() {
    fmt.Println(&quot;Hello, playground&quot;)
    time.Sleep(time.Second)
}"><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-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-s1">fmt</span>.<span class="pl-en">Println</span>(<span class="pl-s">"Hello, playground"</span>)
    <span class="pl-s1">time</span>.<span class="pl-en">Sleep</span>(<span class="pl-s1">time</span>.<span class="pl-c1">Second</span>)
}</pre></div>
<p dir="auto">Note that the named time import has been removed but not reinserted without the name. The resulting code does not compile. Running through goimports again fixes things.</p>
<p dir="auto">Low priority corner case.</p>
<pre class="notranslate">$ goimports &lt;&lt;EOF
package main

import foo "fmt"

func main() { fmt.Println() }
EOF

Prints:

package main

func main() { fmt.Println() }

Low priority, as a second run corrects the import.</pre>