Commit 32a0a1d3 authored by Agniva De Sarker's avatar Agniva De Sarker Committed by Ian Lance Taylor

doc/articles/wiki: highlight the use of _ warning

This moves the paragraph mentioning the use of _ higher up
to emphasize the warning and thereby reducing chances of getting
stuck.

Fixes #22617

Change-Id: I64352a3e966a22d86fc9d381332bade49d74714a
Reviewed-on: https://go-review.googlesource.com/87375Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 0519126a
...@@ -268,6 +268,12 @@ view a wiki page. It will handle URLs prefixed with "/view/". ...@@ -268,6 +268,12 @@ view a wiki page. It will handle URLs prefixed with "/view/".
{{code "doc/articles/wiki/part2.go" `/^func viewHandler/` `/^}/`}} {{code "doc/articles/wiki/part2.go" `/^func viewHandler/` `/^}/`}}
<p>
Again, note the use of <code>_</code> to ignore the <code>error</code>
return value from <code>loadPage</code>. This is done here for simplicity
and generally considered bad practice. We will attend to this later.
</p>
<p> <p>
First, this function extracts the page title from <code>r.URL.Path</code>, First, this function extracts the page title from <code>r.URL.Path</code>,
the path component of the request URL. the path component of the request URL.
...@@ -282,12 +288,6 @@ The function then loads the page data, formats the page with a string of simple ...@@ -282,12 +288,6 @@ The function then loads the page data, formats the page with a string of simple
HTML, and writes it to <code>w</code>, the <code>http.ResponseWriter</code>. HTML, and writes it to <code>w</code>, the <code>http.ResponseWriter</code>.
</p> </p>
<p>
Again, note the use of <code>_</code> to ignore the <code>error</code>
return value from <code>loadPage</code>. This is done here for simplicity
and generally considered bad practice. We will attend to this later.
</p>
<p> <p>
To use this handler, we rewrite our <code>main</code> function to To use this handler, we rewrite our <code>main</code> function to
initialize <code>http</code> using the <code>viewHandler</code> to handle initialize <code>http</code> using the <code>viewHandler</code> to handle
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment