<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="panic: runtime error: index out of range [recovered]
    panic: runtime error: index out of range

goroutine 9 [running]:
regexp.(*machine).backtrack(0xc2085c4ea0, 0xac7ce0, 0xc2085c4f78, 0x0, 0x2b26, 0x0, 0x4b2fc0)
    /Users/rsc/g/go/src/regexp/backtrack.go:343 +0x394
regexp.(*Regexp).doExecute(0xc208085040, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc208a1e000, 0x2b26, 0x0, 0x0, ...)
    /Users/rsc/g/go/src/regexp/exec.go:449 +0x413
regexp.(*Regexp).MatchString(0xc208085040, 0xc208a1e000, 0x2b26, 0x3e00)
    /Users/rsc/g/go/src/regexp/regexp.go:406 +0xc8
main.(*builder).processOutput(0xc20846afc0, 0xc2086a0000, 0x2b26, 0x3e00, 0x0, 0x0)
    /Users/rsc/g/go/src/cmd/go/build.go:1426 +0x146
main.(*builder).build(0xc20846afc0, 0xc208552c30, 0x0, 0x0)
    /Users/rsc/g/go/src/cmd/go/build.go:972 +0x25f6
main.(*builder).do.func1(0xc208552c30)
    /Users/rsc/g/go/src/cmd/go/build.go:737 +0x3a8
main.(*builder).do.func2(0xc2087b2940, 0xc20846afc0, 0xc2087b2920)
    /Users/rsc/g/go/src/cmd/go/build.go:794 +0x155
created by main.(*builder).do
    /Users/rsc/g/go/src/cmd/go/build.go:800 +0x49f"><pre class="notranslate"><code class="notranslate">panic: runtime error: index out of range [recovered]
    panic: runtime error: index out of range

goroutine 9 [running]:
regexp.(*machine).backtrack(0xc2085c4ea0, 0xac7ce0, 0xc2085c4f78, 0x0, 0x2b26, 0x0, 0x4b2fc0)
    /Users/rsc/g/go/src/regexp/backtrack.go:343 +0x394
regexp.(*Regexp).doExecute(0xc208085040, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc208a1e000, 0x2b26, 0x0, 0x0, ...)
    /Users/rsc/g/go/src/regexp/exec.go:449 +0x413
regexp.(*Regexp).MatchString(0xc208085040, 0xc208a1e000, 0x2b26, 0x3e00)
    /Users/rsc/g/go/src/regexp/regexp.go:406 +0xc8
main.(*builder).processOutput(0xc20846afc0, 0xc2086a0000, 0x2b26, 0x3e00, 0x0, 0x0)
    /Users/rsc/g/go/src/cmd/go/build.go:1426 +0x146
main.(*builder).build(0xc20846afc0, 0xc208552c30, 0x0, 0x0)
    /Users/rsc/g/go/src/cmd/go/build.go:972 +0x25f6
main.(*builder).do.func1(0xc208552c30)
    /Users/rsc/g/go/src/cmd/go/build.go:737 +0x3a8
main.(*builder).do.func2(0xc2087b2940, 0xc20846afc0, 0xc2087b2920)
    /Users/rsc/g/go/src/cmd/go/build.go:794 +0x155
created by main.(*builder).do
    /Users/rsc/g/go/src/cmd/go/build.go:800 +0x49f
</code></pre></div>
<p dir="auto">The line in question is</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="b.cap[0] = pos"><pre class="notranslate"><code class="notranslate">b.cap[0] = pos
</code></pre></div>
<p dir="auto">I extracted the specific regexp and input that caused this but in the obvious 1-line program there is no crash. This suggests there is something bad in the caching of machines. I don't have a simple program to provoke this, but maybe that's enough information anyway.</p>
<p dir="auto">by <strong>lvscar</strong>:</p>
<pre class="notranslate">current http lib lack of public function for sending user-defined  headers

make send(src/pkg/http/client.go) public?</pre>