html changes

This commit is contained in:
andrew 2020-03-09 12:55:17 +02:00
parent b66993dc19
commit 678cfab893

View File

@ -46,7 +46,7 @@ of spawning processes from Go.</p>
</td>
<td class="code leading">
<a href="http://play.golang.org/p/jUpRr-RcUKf"><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/m2CpSlHPEVq"><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>
</pre></div>
@ -157,7 +157,7 @@ to exit.</p>
<tr>
<td class="docs">
<p>We ommited error checks in the above example, but
<p>We omitted error checks in the above example, but
you could use the usual <code>if err != nil</code> pattern for
all of them. We also only collect the <code>StdoutPipe</code>
results, but you could collect the <code>StderrPipe</code> in
@ -259,7 +259,7 @@ as if we had run them directly from the command-line.</p>
</div>
<script>
var codeLines = [];
codeLines.push('');codeLines.push('package main\u000A');codeLines.push('import (\u000A \"fmt\"\u000A \"io/ioutil\"\u000A \"os/exec\"\u000A)\u000A');codeLines.push('func main() {\u000A');codeLines.push(' dateCmd := exec.Command(\"date\")\u000A');codeLines.push(' dateOut, err := dateCmd.Output()\u000A if err != nil {\u000A panic(err)\u000A }\u000A fmt.Println(\"\x3E date\")\u000A fmt.Println(string(dateOut))\u000A');codeLines.push(' grepCmd := exec.Command(\"grep\", \"hello\")\u000A');codeLines.push(' grepIn, _ := grepCmd.StdinPipe()\u000A grepOut, _ := grepCmd.StdoutPipe()\u000A grepCmd.Start()\u000A grepIn.Write([]byte(\"hello grep\\ngoodbye grep\"))\u000A grepIn.Close()\u000A grepBytes, _ := ioutil.ReadAll(grepOut)\u000A grepCmd.Wait()\u000A');codeLines.push(' fmt.Println(\"\x3E grep hello\")\u000A fmt.Println(string(grepBytes))\u000A');codeLines.push(' lsCmd := exec.Command(\"bash\", \"-c\", \"ls -a -l -h\")\u000A lsOut, err := lsCmd.Output()\u000A if err != nil {\u000A panic(err)\u000A }\u000A fmt.Println(\"\x3E ls -a -l -h\")\u000A fmt.Println(string(lsOut))\u000A}\u000A');codeLines.push('');codeLines.push('');codeLines.push('');
codeLines.push('');codeLines.push('package main\u000A');codeLines.push('import (\u000A \"fmt\"\u000A \"io/ioutil\"\u000A \"os/exec\"\u000A)\u000A');codeLines.push('func main() {\u000A');codeLines.push(' dateCmd :\x3D exec.Command(\"date\")\u000A');codeLines.push(' dateOut, err :\x3D dateCmd.Output()\u000A if err !\x3D nil {\u000A panic(err)\u000A }\u000A fmt.Println(\"\x3E date\")\u000A fmt.Println(string(dateOut))\u000A');codeLines.push(' grepCmd :\x3D exec.Command(\"grep\", \"hello\")\u000A');codeLines.push(' grepIn, _ :\x3D grepCmd.StdinPipe()\u000A grepOut, _ :\x3D grepCmd.StdoutPipe()\u000A grepCmd.Start()\u000A grepIn.Write([]byte(\"hello grep\\ngoodbye grep\"))\u000A grepIn.Close()\u000A grepBytes, _ :\x3D ioutil.ReadAll(grepOut)\u000A grepCmd.Wait()\u000A');codeLines.push(' fmt.Println(\"\x3E grep hello\")\u000A fmt.Println(string(grepBytes))\u000A');codeLines.push(' lsCmd :\x3D exec.Command(\"bash\", \"-c\", \"ls -a -l -h\")\u000A lsOut, err :\x3D lsCmd.Output()\u000A if err !\x3D nil {\u000A panic(err)\u000A }\u000A fmt.Println(\"\x3E ls -a -l -h\")\u000A fmt.Println(string(lsOut))\u000A}\u000A');codeLines.push('');codeLines.push('');codeLines.push('');
</script>
<script src="site.js" async></script>
</body>