<p dir="auto">Just a documentation issue that - <code class="notranslate">http.ServeMux</code> (cleanPath) gets also rid of duplicate <code class="notranslate">/</code>-s. <code class="notranslate">http.ServeMux</code> already contains:</p>
<blockquote>
<p dir="auto">ServeMux also takes care of sanitizing the URL request path, redirecting any request containing . or .. elements to an equivalent .- and ..-free URL.</p>
</blockquote>
<p dir="auto">I'm not sure how to reword it nicely to include the case of empty path segments, hence I didn't make a CL. Here's shortest example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="package main
import (&quot;fmt&quot;; &quot;net/http&quot;)
func main() {
    http.HandleFunc(&quot;/&quot;, func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, &quot;%s&quot;, r.URL.Path)
    })
    http.ListenAndServe(&quot;:8001&quot;, nil)
}"><pre class="notranslate"><code class="notranslate">package main
import ("fmt"; "net/http")
func main() {
    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "%s", r.URL.Path)
    })
    http.ListenAndServe(":8001", nil)
}
</code></pre></div>
<p dir="auto"><code class="notranslate">/hello////world</code> will redirect to <code class="notranslate">/hello/world</code>. From URI standpoint they are different and both valid (<a href="https://tools.ietf.org/html/rfc3986#section-3.3" rel="nofollow">https://tools.ietf.org/html/rfc3986#section-3.3</a>).</p>
<pre class="notranslate">Some examples:

//Example 1
package main

import "fmt"

func main() {
     const num = 1e1
     s := make([]int, 10)
     fmt.Println(s[num])
}

./test.go:8: non-integer slice index num

// Example 2
package main

import "fmt"

func main() {
     const num = 1e1
     s := make([]int, num)
     fmt.Println(s[num])
}

panic: runtime error: index out of range

goroutine 1 [running]:
main.main()
    /Users/kamil/tmp/test.go:8 +0xb6
exit status 2



num is assignable to a variable of type int, so shouldn't it work as a slice index as
well? It seems like it's being allowed in example 2 and triggering an out of range
panic, but disallowed in example 1.</pre>