<p dir="auto">The handshakeTransport.readLoop can exit with t.cond locked and any handshakeTransport.writePacket calls will block indefinitely at t.cond.Wait().</p>
<p dir="auto">Sorry for the confusion - this is not a duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="97488104" data-permission-text="Title is private" data-url="https://github.com/golang/go/issues/11882" data-hovercard-type="issue" data-hovercard-url="/golang/go/issues/11882/hovercard" href="https://github.com/golang/go/issues/11882">#11882</a> (which solves another issue with a possible deadlock in writePacket) as I initially made a mistake of creating a single problem report for two separate issues.</p>
<p dir="auto">Apologies in advance that this is vague.</p>
<p dir="auto">Symptoms of the problem:</p>
<ul dir="auto">
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/randall77/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/randall77">@randall77</a>'s frustrations with stringer in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="64379546" data-permission-text="Title is private" data-url="https://github.com/golang/go/issues/10249" data-hovercard-type="issue" data-hovercard-url="/golang/go/issues/10249/hovercard" href="https://github.com/golang/go/issues/10249">#10249</a>.</li>
<li>While working on CL 7360, I had to use <code class="notranslate">cmd/internal/gc</code> but <code class="notranslate">./cmd/?g</code>.</li>
<li>The author of a tool picks an importer, but it is the user of a tool that needs to do the dependency resolution. What happens when the author picks <code class="notranslate">gcimporter</code> but the user uses gccgo?</li>
<li>I personally use go/build instead of go/loader in my little one-off tools because go/loader doesn't ever seem to do what I mean but go/build always does. (And I haven't invested the time to dig into why.)</li>
</ul>
<p dir="auto">I'm not familiar enough with go/loader to make a concrete detailed suggestion, but perhaps go/loader could do something like: automatically start with gcimporter (if the object files aren't stale), then fall back to a source importer, and then fall back to other importers (gccgo, llgo, etc.)? And provide hooks so that advanced users can insert their own importers (as I presume Google does internally).</p>
<p dir="auto">/cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/randall77/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/randall77">@randall77</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/alandonovan/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/alandonovan">@alandonovan</a></p>