<p dir="auto">by <strong><a href="mailto:damm@google.com">damm@google.com</a></strong>:</p>
<pre class="notranslate">I found a few issues with "Codelab: Writing Web Applications":

In section "Handling non-existant pages," the function signature includes a
third parameter, "title string" which is not introduced until later in the
last section.  This may be confusing to some readers.

In section "Template caching," the code snippet for the init() function is not
in blockquote source code formatting.

In section "Validation," the code block for constructing the regular
expression is empty.  I think it is supposed to read:

"""
var titleValidator regexp.Regexp = regexp.MustCompile("^[a-zA-Z0-9]+$")
"""

but there currently is nothing in the &lt;pre&gt; tag for that line.

Also, this is not an error, but it would be circumspect if you could give an example URL
that would be dangerous in the "Validation" section.  When I tried to do
something nasty like "<a href="http://localhost:8080/view/" rel="nofollow">http://localhost:8080/view/</a>../../../etc/passwd" or
similar, the URL was automatically rewritten to remove all '../' and preceding
directories.  I suppose this is a part of the URL parsing in the http package?  I was
able to form an attack only by creating more files underneath my tree (or soft-linking
my home directory from the go-wiki directory), and even then only when the extension
matched the one used for wiki content (which I had changed to .wiki early on).  Even if
this is the extent of that possible attack, I agree that it's a good idea to mention it,
I just think a more specific example might be worthwhile.

Great tutorial, thanks for providing it!</pre>
<p dir="auto">Under normal circumstances you would place test code into a file matching the <code class="notranslate">test</code> build constraint/tag, e.g. <code class="notranslate">my_test.go</code>. The naming convention of the file has led me to believe that this is a build constraint/tag.</p>
<p dir="auto">However, it is not possible to <em>exclude</em> some code from being built into tests ran by <code class="notranslate">go test</code>, because writing a file like <code class="notranslate">foo.go</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// +build !test

package foo

..."><pre class="notranslate"><code class="notranslate">// +build !test

package foo

...
</code></pre></div>
<p dir="auto">Will always compile under <code class="notranslate">go test</code>. This is a shame because there are some situations that do warrant different behavior for testing, and this makes it hard to deal with such situations.</p>