Rename embedding to struct embedding to be separated from //go:embed directive (#424)

Signed-off-by: peterzhu1992 <peterzhu1992@gmail.com>
This commit is contained in:
peterzhu1992 2022-05-17 13:59:35 -04:00 committed by GitHub
parent 9deadb76ae
commit a19c5b87e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 20 additions and 14 deletions

View File

@ -19,7 +19,7 @@ Strings and Runes
Structs
Methods
Interfaces
Embedding
Struct Embedding
Generics
Errors
Goroutines

View File

@ -1,2 +0,0 @@
316e334f61f03d59c8a45889a057903a786534ba
k5Z_CnP8DK9

View File

@ -1,5 +1,8 @@
// Go supports _embedding_ of structs and interfaces
// to express a more seamless _composition_ of types.
// This is not to be confused with `//go:embed` which is
// a go directive introduced in Go version 1.16+ to embed
// files and folders into the application binary.
package main

View File

@ -0,0 +1,2 @@
a246237126303fb110186ac2598bca15d36e8366
TqMui3hJuX7

View File

@ -1,4 +1,4 @@
$ go run embedding.go
$ go run struct-embedding.go
co={num: 1, str: some name}
also num: 1
describe: base with num=1

2
public/generics generated
View File

@ -9,7 +9,7 @@
onkeydown = (e) => {
if (e.key == "ArrowLeft") {
window.location.href = 'embedding';
window.location.href = 'struct-embedding';
}

2
public/index.html generated
View File

@ -69,7 +69,7 @@
<li><a href="interfaces">Interfaces</a></li>
<li><a href="embedding">Embedding</a></li>
<li><a href="struct-embedding">Struct Embedding</a></li>
<li><a href="generics">Generics</a></li>

4
public/interfaces generated
View File

@ -14,7 +14,7 @@
if (e.key == "ArrowRight") {
window.location.href = 'embedding';
window.location.href = 'struct-embedding';
}
}
@ -222,7 +222,7 @@ these structs as arguments to <code>measure</code>.</p>
<p class="next">
Next example: <a href="embedding">Embedding</a>.
Next example: <a href="struct-embedding">Struct Embedding</a>.
</p>

View File

@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>Go by Example: Embedding</title>
<title>Go by Example: Struct Embedding</title>
<link rel=stylesheet href="site.css">
</head>
<script>
@ -20,15 +20,18 @@
}
</script>
<body>
<div class="example" id="embedding">
<h2><a href="./">Go by Example</a>: Embedding</h2>
<div class="example" id="struct-embedding">
<h2><a href="./">Go by Example</a>: Struct Embedding</h2>
<table>
<tr>
<td class="docs">
<p>Go supports <em>embedding</em> of structs and interfaces
to express a more seamless <em>composition</em> of types.</p>
to express a more seamless <em>composition</em> of types.
This is not to be confused with <code>//go:embed</code> which is
a go directive introduced in Go version 1.16+ to embed
files and folders into the application binary.</p>
</td>
<td class="code empty leading">
@ -42,7 +45,7 @@ to express a more seamless <em>composition</em> of types.</p>
</td>
<td class="code leading">
<a href="http://play.golang.org/p/k5Z_CnP8DK9"><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>
</td>
@ -218,7 +221,7 @@ we see that a <code>container</code> now implements the
</td>
<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><span class="go">also num: 1
</span><span class="go">describe: base with num=1