Skip to content

Commit

Permalink
Japanese, content
Browse files Browse the repository at this point in the history
  • Loading branch information
teivah committed Oct 10, 2023
1 parent 555f9bb commit af8a2d0
Show file tree
Hide file tree
Showing 21 changed files with 1,305 additions and 30 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build:
mkdocs build
serve:
mkdocs serve
test:
mkdocs build && mkdocs serve
5 changes: 4 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ extra:
- name: 🇬🇧 English
link: /
lang: en
- name: 🇨🇳 Chinese (Simplified)
- name: 🇨🇳 Chinese Simplified
link: /zh/
lang: zh
- name: 🇯🇵 Japanese (進行中)
link: /ja/
lang: ja
social:
- icon: fontawesome/brands/twitter
link: https://twitter.com/teivah
Expand Down
8 changes: 7 additions & 1 deletion site/20-slice/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down
8 changes: 7 additions & 1 deletion site/28-maps-memory-leaks/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down
8 changes: 7 additions & 1 deletion site/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down
8 changes: 7 additions & 1 deletion site/56-concurrency-faster/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down
8 changes: 7 additions & 1 deletion site/89-benchmarks/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down
10 changes: 8 additions & 2 deletions site/9-generics/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down Expand Up @@ -980,7 +986,7 @@ <h2 id="concepts">Concepts</h2>
<p>To handle the map, we defined two kinds of type parameters. First, the values can be of any type: <code>V any</code>. However, in Go, the map keys can’t be of any type. For example, we cannot use slices:</p>
<div class="language-go highlight"><pre><span></span><code><span id="__span-4-1"><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a><span class="kd">var</span><span class="w"> </span><span class="nx">m</span><span class="w"> </span><span class="kd">map</span><span class="p">[[]</span><span class="kt">byte</span><span class="p">]</span><span class="kt">int</span>
</span></code></pre></div>
<p>This code leads to a compilation error: <code>invalid map key type []byte</code>. Therefore, instead of accepting any key type, we are obliged to restrict type arguments so that the key type meets specific requirements. Here, being comparable (we can use <code>==</code> or <code>!=</code>). Hence, we defined <code>K</code> as <code>comparable</code> instead of <code>a``ny</code>.</p>
<p>This code leads to a compilation error: <code>invalid map key type []byte</code>. Therefore, instead of accepting any key type, we are obliged to restrict type arguments so that the key type meets specific requirements. Here, being comparable (we can use <code>==</code> or <code>!=</code>). Hence, we defined <code>K</code> as <code>comparable</code> instead of <code>any</code>.</p>
<p>Restricting type arguments to match specific requirements is called a constraint. A constraint is an interface type that can contain:</p>
<ul>
<li>A set of behaviors (methods)</li>
Expand Down
8 changes: 7 additions & 1 deletion site/98-profiling-execution-tracing/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down
Binary file added site/assets/images/social/ja.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion site/book/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down
8 changes: 7 additions & 1 deletion site/chapter-1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down
8 changes: 7 additions & 1 deletion site/external/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down
16 changes: 13 additions & 3 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,13 @@

<li class="md-select__item">
<a href="/zh/" hreflang="zh" class="md-select__link">
🇨🇳 Chinese (Simplified)
🇨🇳 Chinese Simplified
</a>
</li>

<li class="md-select__item">
<a href="/ja/" hreflang="ja" class="md-select__link">
🇯🇵 Japanese (進行中)
</a>
</li>

Expand Down Expand Up @@ -3492,7 +3498,7 @@ <h3 id="unintended-side-effects-with-named-result-parameters-44">Unintended side
<h3 id="returning-a-nil-receiver-45">Returning a nil receiver (#45)</h3>
<details class="info" open="open">
<summary>TL;DR</summary>
<p>When returning an interface, be cautious about returning not a nil pointer but an explicit nil value. Otherwise, unintended consequences may result because the caller will receive a non-nil value.</p>
<p>When returning an interface, be cautious about not returning a nil pointer but an explicit nil value. Otherwise, unintended consequences may occur and the caller will receive a non-nil value.</p>
</details>
<!-- TODO -->

Expand Down Expand Up @@ -3800,6 +3806,10 @@ <h3 id="propagating-an-inappropriate-context-61">Propagating an inappropriate co
<li>However, if the response is written before or during the Kafka publication, the message shouldn’t be published.</li>
</ul>
<p>In the latter case, calling publish will return an error because we returned the HTTP response quickly.</p>
<details class="note" open="open">
<summary>Note</summary>
<p>From Go 1.21, there is a way to create a new context without cancel. <a href="https://pkg.go.dev/context#WithoutCancel"><code>context.WithoutCancel</code></a> returns a copy of parent that is not canceled when parent is canceled.</p>
</details>
<p>In summary, propagating a context should be done cautiously.</p>
<p><a href="https://github.com/teivah/100-go-mistakes/tree/master/src/09-concurrency-practice/61-inappropriate-context/main.go">Source code <span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></span></a></p>
<h3 id="starting-a-goroutine-without-knowing-when-to-stop-it-62">Starting a goroutine without knowing when to stop it (#62)</h3>
Expand Down Expand Up @@ -3867,7 +3877,7 @@ <h3 id="expecting-a-deterministic-behavior-using-select-and-channels-64">Expecti
<p>Understanding that <code>select</code> with multiple channels chooses the case randomly if multiple options are possible prevents making wrong assumptions that can lead to subtle concurrency bugs.</p>
</details>
<p>One common mistake made by Go developers while working with channels is to make wrong assumptions about how select behaves with multiple channels.</p>
<p>For example, let's consider the following case (<code>disconnectCh</code> is a buffered channel):</p>
<p>For example, let's consider the following case (<code>disconnectCh</code> is a unbuffered channel):</p>
<div class="language-go highlight"><pre><span></span><code><span id="__span-40-1"><a id="__codelineno-40-1" name="__codelineno-40-1" href="#__codelineno-40-1"></a><span class="k">go</span><span class="w"> </span><span class="kd">func</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-40-2"><a id="__codelineno-40-2" name="__codelineno-40-2" href="#__codelineno-40-2"></a><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="nx">i</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="nx">i</span><span class="w"> </span><span class="p">&lt;</span><span class="w"> </span><span class="mi">10</span><span class="p">;</span><span class="w"> </span><span class="nx">i</span><span class="o">++</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-40-3"><a id="__codelineno-40-3" name="__codelineno-40-3" href="#__codelineno-40-3"></a><span class="w"> </span><span class="nx">messageCh</span><span class="w"> </span><span class="o">&lt;-</span><span class="w"> </span><span class="nx">i</span>
Expand Down
Loading

0 comments on commit af8a2d0

Please sign in to comment.