<p dir="auto">The .svg profile as generated by pprof's <code class="notranslate">web</code> command includes some Javascript from <a href="https://www.cyberz.org/projects/SVGPan/SVGPan.js" rel="nofollow">https://www.cyberz.org/projects/SVGPan/SVGPan.js</a></p>
<p dir="auto">the file is linked here: </p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/golang/go/blob/5f8423844463b3b77588e46ea57f44d8b69a1564/src/cmd/pprof/internal/driver/driver.go#L628">go/src/cmd/pprof/internal/driver/driver.go</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 628
      in
      <a data-pjax="true" class="commit-tease-sha" href="/golang/go/commit/5f8423844463b3b77588e46ea57f44d8b69a1564">5f84238</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L628" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="628"></td>
          <td id="LC628" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-c1">flagSVGPan</span>: <span class="pl-s1">flag</span>.<span class="pl-en">String</span>(<span class="pl-s">"svgpan"</span>, <span class="pl-s">"https://www.cyberz.org/projects/SVGPan/SVGPan.js"</span>, <span class="pl-s">"URL for SVGPan Library"</span>), </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">I found it surprising to find pprof's SVG has external dependencies. Not just because of tracking reasons (I don't think cyberz.org need to know about my pprof usage), but also because it doesn't always work (e.g. working on a train).</p>
<p dir="auto">Would it be possible to just include the javascript code verbatim in the .SVG, or otherwise to not include the external link by default?</p>
<p dir="auto">by <strong>shiblon</strong>:</p>
<pre class="notranslate">In the Effective Go document, the following example appears in the Goroutines section:

func Serve(queue chan *Request) {
    for req := range queue {
        &lt;-sem
        go func() {
            process(req)
            sem &lt;- 1
        }()
    }
}

This example is not going to work, however, because "req" gets reused at every
iteration of the loop. In order for it to be correct, it would either need "req :=
req" at the beginning of the loop body, or the request should be passed in thus:

func Serve(queue chan *Request) {
    for req := range queue {
        &lt;-sem
        go func(r *Request) {
            process(r)
            sem &lt;- 1
        }(req)
    }
}

I am not sure which of the two approaches would be more idiomatic in Go (creating a new
local variable at every iteration vs. passing in a parameter), but the one that is
currently there appears incorrect.</pre>