Minor tweaks
Signed-off-by: peterzhu1992 <peterzhu1992@gmail.com>
This commit is contained in:
parent
f900918c93
commit
7798376aa3
@ -1,7 +1,7 @@
|
|||||||
// Go supports _embedding_ of structs and interfaces
|
// Go supports _embedding_ of structs and interfaces
|
||||||
// to express a more seamless _composition_ of types.
|
// to express a more seamless _composition_ of types.
|
||||||
// This is not to be confused with _go:embed_ which is
|
// This is not to be confused with `//go:embed` which is
|
||||||
// a go directive introduced in go version 1.16 to embed
|
// a go directive introduced in Go version 1.16+ to embed
|
||||||
// files and folders into the application binary.
|
// files and folders into the application binary.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
8ec60ccaf4c5803bd65a776e05b458b008ae52a7
|
a246237126303fb110186ac2598bca15d36e8366
|
||||||
4B33kwDJ3fm
|
TqMui3hJuX7
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$ go run embedding.go
|
$ go run struct-embedding.go
|
||||||
co={num: 1, str: some name}
|
co={num: 1, str: some name}
|
||||||
also num: 1
|
also num: 1
|
||||||
describe: base with num=1
|
describe: base with num=1
|
||||||
|
8
public/struct-embedding
generated
8
public/struct-embedding
generated
@ -29,8 +29,8 @@
|
|||||||
<td class="docs">
|
<td class="docs">
|
||||||
<p>Go supports <em>embedding</em> of structs and interfaces
|
<p>Go supports <em>embedding</em> of structs and interfaces
|
||||||
to express a more seamless <em>composition</em> of types.
|
to express a more seamless <em>composition</em> of types.
|
||||||
This is not to be confused with <em>go:embed</em> which is
|
This is not to be confused with <code>//go:embed</code> which is
|
||||||
a go directive introduced in go version 1.16 to embed
|
a go directive introduced in Go version 1.16+ to embed
|
||||||
files and folders into the application binary.</p>
|
files and folders into the application binary.</p>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
@ -45,7 +45,7 @@ files and folders into the application binary.</p>
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td class="code leading">
|
<td class="code leading">
|
||||||
<a href="http://play.golang.org/p/4B33kwDJ3fm"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
|
<a href="http://play.golang.org/p/TqMui3hJuX7"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
|
||||||
<pre class="chroma"><span class="kn">package</span> <span class="nx">main</span>
|
<pre class="chroma"><span class="kn">package</span> <span class="nx">main</span>
|
||||||
</pre>
|
</pre>
|
||||||
</td>
|
</td>
|
||||||
@ -221,7 +221,7 @@ we see that a <code>container</code> now implements the
|
|||||||
</td>
|
</td>
|
||||||
<td class="code">
|
<td class="code">
|
||||||
|
|
||||||
<pre class="chroma"><span class="gp">$</span> go run embedding.go
|
<pre class="chroma"><span class="gp">$</span> go run struct-embedding.go
|
||||||
<span class="go">co={num: 1, str: some name}
|
<span class="go">co={num: 1, str: some name}
|
||||||
</span><span class="go">also num: 1
|
</span><span class="go">also num: 1
|
||||||
</span><span class="go">describe: base with num=1
|
</span><span class="go">describe: base with num=1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user