Merge branch 'andrew-field-fix/linting'

This commit is contained in:
Mark McGranaghan 2020-04-10 17:57:06 -07:00
commit 20a46109b8
6 changed files with 11 additions and 13 deletions

View File

@ -21,9 +21,8 @@ import (
func IntMin(a, b int) int { func IntMin(a, b int) int {
if a < b { if a < b {
return a return a
} else {
return b
} }
return b
} }
// A test is created by writing a function with a name // A test is created by writing a function with a name

View File

@ -1,2 +1,2 @@
017c9d7ba927cdfbcef1643e86f9b8022f13fc31 8e15d97f54c34ac1546c2ec6589cc1b60ff27f80
jCRgtgRwie3 GFuPdlBlyMU

View File

@ -8,7 +8,7 @@ import (
"fmt" "fmt"
) )
// This type will be mapped to XML. Similarly to the // Plant will be mapped to XML. Similarly to the
// JSON examples, field tags contain directives for the // JSON examples, field tags contain directives for the
// encoder and decoder. Here we use some special features // encoder and decoder. Here we use some special features
// of the XML package: the `XMLName` field name dictates // of the XML package: the `XMLName` field name dictates

View File

@ -1,2 +1,2 @@
f42dec8593a45931145f0a55f104f2ca34b2d112 d5da1784f3aa0bbba452d21c70833621a62159f4
wlkywJsuWqL RsNLhMBazeX

7
public/testing generated
View File

@ -47,7 +47,7 @@ typically lives in the same package as the code it tests.</p>
</td> </td>
<td class="code leading"> <td class="code leading">
<a href="http://play.golang.org/p/jCRgtgRwie3"><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/GFuPdlBlyMU"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span> <div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
</pre></div> </pre></div>
@ -83,9 +83,8 @@ be named <code>intutils_test.go</code>.</p>
<div class="highlight"><pre><span class="kd">func</span> <span class="nx">IntMin</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span> <span class="nx">b</span> <span class="kt">int</span><span class="p">)</span> <span class="kt">int</span> <span class="p">{</span> <div class="highlight"><pre><span class="kd">func</span> <span class="nx">IntMin</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span> <span class="nx">b</span> <span class="kt">int</span><span class="p">)</span> <span class="kt">int</span> <span class="p">{</span>
<span class="k">if</span> <span class="nx">a</span> <span class="p">&lt;</span> <span class="nx">b</span> <span class="p">{</span> <span class="k">if</span> <span class="nx">a</span> <span class="p">&lt;</span> <span class="nx">b</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">a</span> <span class="k">return</span> <span class="nx">a</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">b</span>
<span class="p">}</span> <span class="p">}</span>
<span class="k">return</span> <span class="nx">b</span>
<span class="p">}</span> <span class="p">}</span>
</pre></div> </pre></div>
@ -232,7 +231,7 @@ when executing <code>go test -v</code>.</p>
</div> </div>
<script> <script>
var codeLines = []; var codeLines = [];
codeLines.push('');codeLines.push('package main\u000A');codeLines.push('import (\u000A \"fmt\"\u000A \"testing\"\u000A)\u000A');codeLines.push('func IntMin(a, b int) int {\u000A if a \x3C b {\u000A return a\u000A } else {\u000A return b\u000A }\u000A}\u000A');codeLines.push('func TestIntMinBasic(t *testing.T) {\u000A ans :\x3D IntMin(2, -2)\u000A if ans !\x3D -2 {\u000A');codeLines.push(' t.Errorf(\"IntMin(2, -2) \x3D %d; want -2\", ans)\u000A }\u000A}\u000A');codeLines.push('func TestIntMinTableDriven(t *testing.T) {\u000A var tests \x3D []struct {\u000A a, b int\u000A want int\u000A }{\u000A {0, 1, 0},\u000A {1, 0, 0},\u000A {2, -2, -2},\u000A {0, -1, -1},\u000A {-1, 0, -1},\u000A }\u000A');codeLines.push(' for _, tt :\x3D range tests {\u000A');codeLines.push(' testname :\x3D fmt.Sprintf(\"%d,%d\", tt.a, tt.b)\u000A t.Run(testname, func(t *testing.T) {\u000A ans :\x3D IntMin(tt.a, tt.b)\u000A if ans !\x3D tt.want {\u000A t.Errorf(\"got %d, want %d\", ans, tt.want)\u000A }\u000A })\u000A }\u000A}\u000A');codeLines.push(''); codeLines.push('');codeLines.push('package main\u000A');codeLines.push('import (\u000A \"fmt\"\u000A \"testing\"\u000A)\u000A');codeLines.push('func IntMin(a, b int) int {\u000A if a \x3C b {\u000A return a\u000A }\u000A return b\u000A}\u000A');codeLines.push('func TestIntMinBasic(t *testing.T) {\u000A ans :\x3D IntMin(2, -2)\u000A if ans !\x3D -2 {\u000A');codeLines.push(' t.Errorf(\"IntMin(2, -2) \x3D %d; want -2\", ans)\u000A }\u000A}\u000A');codeLines.push('func TestIntMinTableDriven(t *testing.T) {\u000A var tests \x3D []struct {\u000A a, b int\u000A want int\u000A }{\u000A {0, 1, 0},\u000A {1, 0, 0},\u000A {2, -2, -2},\u000A {0, -1, -1},\u000A {-1, 0, -1},\u000A }\u000A');codeLines.push(' for _, tt :\x3D range tests {\u000A');codeLines.push(' testname :\x3D fmt.Sprintf(\"%d,%d\", tt.a, tt.b)\u000A t.Run(testname, func(t *testing.T) {\u000A ans :\x3D IntMin(tt.a, tt.b)\u000A if ans !\x3D tt.want {\u000A t.Errorf(\"got %d, want %d\", ans, tt.want)\u000A }\u000A })\u000A }\u000A}\u000A');codeLines.push('');
</script> </script>
<script src="site.js" async></script> <script src="site.js" async></script>
</body> </body>

4
public/xml generated
View File

@ -42,7 +42,7 @@ formats with the <code>encoding.xml</code> package.</p>
</td> </td>
<td class="code leading"> <td class="code leading">
<a href="http://play.golang.org/p/wlkywJsuWqL"><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/RsNLhMBazeX"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span> <div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
</pre></div> </pre></div>
@ -66,7 +66,7 @@ formats with the <code>encoding.xml</code> package.</p>
<tr> <tr>
<td class="docs"> <td class="docs">
<p>This type will be mapped to XML. Similarly to the <p>Plant will be mapped to XML. Similarly to the
JSON examples, field tags contain directives for the JSON examples, field tags contain directives for the
encoder and decoder. Here we use some special features encoder and decoder. Here we use some special features
of the XML package: the <code>XMLName</code> field name dictates of the XML package: the <code>XMLName</code> field name dictates