Skip to content

Commit

Permalink
Fixing remaining code annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
teivah committed Mar 10, 2024
1 parent 3c6f045 commit fb76246
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ func f() error {
return err
}

status = StatusSuccess <5>
status = StatusSuccess
return nil
}
```
Expand Down Expand Up @@ -1750,7 +1750,7 @@ func (c *Customer) UpdateAge(age int) error {
return fmt.Errorf("age should be positive for customer %v", c)
}

c.mutex.Lock() <1>
c.mutex.Lock()
defer c.mutex.Unlock()

c.age = age
Expand Down
10 changes: 5 additions & 5 deletions docs/ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ func WithPort(port int) Option {
}
}

func NewServer(addr string, opts ...Option) ( *http.Server, error) { <1>
var options options <2>
for _, opt := range opts { <3>
err := opt(&options) <4>
func NewServer(addr string, opts ...Option) ( *http.Server, error) {
var options options
for _, opt := range opts {
err := opt(&options)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1076,7 +1076,7 @@ func f() error {
return err
}

status = StatusSuccess <5>
status = StatusSuccess
return nil
}
```
Expand Down
2 changes: 1 addition & 1 deletion site/9-generics/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ <h2 id="concepts">Concepts</h2>
<p>When calling <code>foo</code>, we will pass a type argument of any type. Passing a type argument is called instantiation because the work is done at compile time which keeps type safety as part of the core language features and avoids runtime overheads.</p>
<p>Let’s get back to the <code>getKeys</code> function and use type parameters to write a generic version that would accept any kind of map:</p>
<div class="language-go highlight"><pre><span></span><code><span id="__span-3-1"><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a><span class="kd">func</span><span class="w"> </span><span class="nx">getKeys</span><span class="p">[</span><span class="nx">K</span><span class="w"> </span><span class="kt">comparable</span><span class="p">,</span><span class="w"> </span><span class="nx">V</span><span class="w"> </span><span class="kt">any</span><span class="p">](</span><span class="nx">m</span><span class="w"> </span><span class="kd">map</span><span class="p">[</span><span class="nx">K</span><span class="p">]</span><span class="nx">V</span><span class="p">)</span><span class="w"> </span><span class="p">[]</span><span class="nx">K</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-2"><a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a><span class="w"> </span><span class="kd">var</span><span class="w"> </span><span class="nx">keys</span><span class="w"> </span><span class="p">[]</span><span class="nx">K</span><span class="w"> </span><span class="p">&lt;</span><span class="mi">2</span><span class="p">&gt;</span>
</span><span id="__span-3-2"><a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a><span class="w"> </span><span class="kd">var</span><span class="w"> </span><span class="nx">keys</span><span class="w"> </span><span class="p">[]</span><span class="nx">K</span>
</span><span id="__span-3-3"><a id="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="nx">k</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="k">range</span><span class="w"> </span><span class="nx">m</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-4"><a id="__codelineno-3-4" name="__codelineno-3-4" href="#__codelineno-3-4"></a><span class="w"> </span><span class="nx">keys</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nb">append</span><span class="p">(</span><span class="nx">keys</span><span class="p">,</span><span class="w"> </span><span class="nx">k</span><span class="p">)</span>
</span><span id="__span-3-5"><a id="__codelineno-3-5" name="__codelineno-3-5" href="#__codelineno-3-5"></a><span class="w"> </span><span class="p">}</span>
Expand Down
4 changes: 2 additions & 2 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4192,7 +4192,7 @@ <h3 id="ignoring-how-defer-arguments-and-receivers-are-evaluated-argument-evalua
</span><span id="__span-27-19"><a id="__codelineno-27-19" name="__codelineno-27-19" href="#__codelineno-27-19"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nx">err</span>
</span><span id="__span-27-20"><a id="__codelineno-27-20" name="__codelineno-27-20" href="#__codelineno-27-20"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-27-21"><a id="__codelineno-27-21" name="__codelineno-27-21" href="#__codelineno-27-21"></a>
</span><span id="__span-27-22"><a id="__codelineno-27-22" name="__codelineno-27-22" href="#__codelineno-27-22"></a><span class="w"> </span><span class="nx">status</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nx">StatusSuccess</span><span class="w"> </span><span class="p">&lt;</span><span class="mi">5</span><span class="p">&gt;</span>
</span><span id="__span-27-22"><a id="__codelineno-27-22" name="__codelineno-27-22" href="#__codelineno-27-22"></a><span class="w"> </span><span class="nx">status</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nx">StatusSuccess</span>
</span><span id="__span-27-23"><a id="__codelineno-27-23" name="__codelineno-27-23" href="#__codelineno-27-23"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="kc">nil</span>
</span><span id="__span-27-24"><a id="__codelineno-27-24" name="__codelineno-27-24" href="#__codelineno-27-24"></a><span class="p">}</span>
</span></code></pre></div>
Expand Down Expand Up @@ -4699,7 +4699,7 @@ <h4 id="deadlock">Deadlock</h4>
</span></span><span id="__span-50-3"><a id="__codelineno-50-3" name="__codelineno-50-3" href="#__codelineno-50-3"></a><span class="hll"><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nx">fmt</span><span class="p">.</span><span class="nx">Errorf</span><span class="p">(</span><span class="s">&quot;age should be positive for customer %v&quot;</span><span class="p">,</span><span class="w"> </span><span class="nx">c</span><span class="p">)</span>
</span></span><span id="__span-50-4"><a id="__codelineno-50-4" name="__codelineno-50-4" href="#__codelineno-50-4"></a><span class="hll"><span class="w"> </span><span class="p">}</span>
</span></span><span id="__span-50-5"><a id="__codelineno-50-5" name="__codelineno-50-5" href="#__codelineno-50-5"></a>
</span><span id="__span-50-6"><a id="__codelineno-50-6" name="__codelineno-50-6" href="#__codelineno-50-6"></a><span class="w"> </span><span class="nx">c</span><span class="p">.</span><span class="nx">mutex</span><span class="p">.</span><span class="nx">Lock</span><span class="p">()</span><span class="w"> </span><span class="p">&lt;</span><span class="mi">1</span><span class="p">&gt;</span>
</span><span id="__span-50-6"><a id="__codelineno-50-6" name="__codelineno-50-6" href="#__codelineno-50-6"></a><span class="w"> </span><span class="nx">c</span><span class="p">.</span><span class="nx">mutex</span><span class="p">.</span><span class="nx">Lock</span><span class="p">()</span>
</span><span id="__span-50-7"><a id="__codelineno-50-7" name="__codelineno-50-7" href="#__codelineno-50-7"></a><span class="w"> </span><span class="k">defer</span><span class="w"> </span><span class="nx">c</span><span class="p">.</span><span class="nx">mutex</span><span class="p">.</span><span class="nx">Unlock</span><span class="p">()</span>
</span><span id="__span-50-8"><a id="__codelineno-50-8" name="__codelineno-50-8" href="#__codelineno-50-8"></a>
</span><span id="__span-50-9"><a id="__codelineno-50-9" name="__codelineno-50-9" href="#__codelineno-50-9"></a><span class="w"> </span><span class="nx">c</span><span class="p">.</span><span class="nx">age</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nx">age</span>
Expand Down
10 changes: 5 additions & 5 deletions site/ja/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3499,10 +3499,10 @@ <h3 id="functional-options-11">Functional Options パターンを使用してい
</span><span id="__span-5-14"><a id="__codelineno-5-14" name="__codelineno-5-14" href="#__codelineno-5-14"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-5-15"><a id="__codelineno-5-15" name="__codelineno-5-15" href="#__codelineno-5-15"></a><span class="p">}</span>
</span><span id="__span-5-16"><a id="__codelineno-5-16" name="__codelineno-5-16" href="#__codelineno-5-16"></a>
</span><span id="__span-5-17"><a id="__codelineno-5-17" name="__codelineno-5-17" href="#__codelineno-5-17"></a><span class="kd">func</span><span class="w"> </span><span class="nx">NewServer</span><span class="p">(</span><span class="nx">addr</span><span class="w"> </span><span class="kt">string</span><span class="p">,</span><span class="w"> </span><span class="nx">opts</span><span class="w"> </span><span class="o">...</span><span class="nx">Option</span><span class="p">)</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="o">*</span><span class="nx">http</span><span class="p">.</span><span class="nx">Server</span><span class="p">,</span><span class="w"> </span><span class="kt">error</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">&lt;</span><span class="mi">1</span><span class="p">&gt;</span>
</span><span id="__span-5-18"><a id="__codelineno-5-18" name="__codelineno-5-18" href="#__codelineno-5-18"></a><span class="w"> </span><span class="kd">var</span><span class="w"> </span><span class="nx">options</span><span class="w"> </span><span class="nx">options</span><span class="w"> </span><span class="p">&lt;</span><span class="mi">2</span><span class="p">&gt;</span>
</span><span id="__span-5-19"><a id="__codelineno-5-19" name="__codelineno-5-19" href="#__codelineno-5-19"></a><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="nx">_</span><span class="p">,</span><span class="w"> </span><span class="nx">opt</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="k">range</span><span class="w"> </span><span class="nx">opts</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">&lt;</span><span class="mi">3</span><span class="p">&gt;</span>
</span><span id="__span-5-20"><a id="__codelineno-5-20" name="__codelineno-5-20" href="#__codelineno-5-20"></a><span class="w"> </span><span class="nx">err</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="nx">opt</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">options</span><span class="p">)</span><span class="w"> </span><span class="p">&lt;</span><span class="mi">4</span><span class="p">&gt;</span>
</span><span id="__span-5-17"><a id="__codelineno-5-17" name="__codelineno-5-17" href="#__codelineno-5-17"></a><span class="kd">func</span><span class="w"> </span><span class="nx">NewServer</span><span class="p">(</span><span class="nx">addr</span><span class="w"> </span><span class="kt">string</span><span class="p">,</span><span class="w"> </span><span class="nx">opts</span><span class="w"> </span><span class="o">...</span><span class="nx">Option</span><span class="p">)</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="o">*</span><span class="nx">http</span><span class="p">.</span><span class="nx">Server</span><span class="p">,</span><span class="w"> </span><span class="kt">error</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-5-18"><a id="__codelineno-5-18" name="__codelineno-5-18" href="#__codelineno-5-18"></a><span class="w"> </span><span class="kd">var</span><span class="w"> </span><span class="nx">options</span><span class="w"> </span><span class="nx">options</span>
</span><span id="__span-5-19"><a id="__codelineno-5-19" name="__codelineno-5-19" href="#__codelineno-5-19"></a><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="nx">_</span><span class="p">,</span><span class="w"> </span><span class="nx">opt</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="k">range</span><span class="w"> </span><span class="nx">opts</span><span class="w"> </span><span class="p">{</span><span class="w"> </span>
</span><span id="__span-5-20"><a id="__codelineno-5-20" name="__codelineno-5-20" href="#__codelineno-5-20"></a><span class="w"> </span><span class="nx">err</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="nx">opt</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">options</span><span class="p">)</span><span class="w"> </span>
</span><span id="__span-5-21"><a id="__codelineno-5-21" name="__codelineno-5-21" href="#__codelineno-5-21"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="nx">err</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="kc">nil</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-5-22"><a id="__codelineno-5-22" name="__codelineno-5-22" href="#__codelineno-5-22"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="kc">nil</span><span class="p">,</span><span class="w"> </span><span class="nx">err</span>
</span><span id="__span-5-23"><a id="__codelineno-5-23" name="__codelineno-5-23" href="#__codelineno-5-23"></a><span class="w"> </span><span class="p">}</span>
Expand Down Expand Up @@ -4125,7 +4125,7 @@ <h3 id="defer-47"><code>defer</code> 引数とレシーバーがどのように
</span><span id="__span-27-19"><a id="__codelineno-27-19" name="__codelineno-27-19" href="#__codelineno-27-19"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nx">err</span>
</span><span id="__span-27-20"><a id="__codelineno-27-20" name="__codelineno-27-20" href="#__codelineno-27-20"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-27-21"><a id="__codelineno-27-21" name="__codelineno-27-21" href="#__codelineno-27-21"></a>
</span><span id="__span-27-22"><a id="__codelineno-27-22" name="__codelineno-27-22" href="#__codelineno-27-22"></a><span class="w"> </span><span class="nx">status</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nx">StatusSuccess</span><span class="w"> </span><span class="p">&lt;</span><span class="mi">5</span><span class="p">&gt;</span>
</span><span id="__span-27-22"><a id="__codelineno-27-22" name="__codelineno-27-22" href="#__codelineno-27-22"></a><span class="w"> </span><span class="nx">status</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nx">StatusSuccess</span>
</span><span id="__span-27-23"><a id="__codelineno-27-23" name="__codelineno-27-23" href="#__codelineno-27-23"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="kc">nil</span>
</span><span id="__span-27-24"><a id="__codelineno-27-24" name="__codelineno-27-24" href="#__codelineno-27-24"></a><span class="p">}</span>
</span></code></pre></div>
Expand Down
2 changes: 1 addition & 1 deletion site/search/search_index.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions site/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,72 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://100go.co/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/20-slice/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/28-maps-memory-leaks/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/5-interface-pollution/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/56-concurrency-faster/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/89-benchmarks/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/9-generics/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/92-false-sharing/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/98-profiling-execution-tracing/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/book/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/chapter-1/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/external/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/ja/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://100go.co/zh/</loc>
<lastmod>2024-03-07</lastmod>
<lastmod>2024-03-10</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>
Binary file modified site/sitemap.xml.gz
Binary file not shown.

0 comments on commit fb76246

Please sign in to comment.