mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2025-12-17 19:24:19 +08:00
deploy: 56bbafbd08
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>函数声明 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h2>5.1. 函数声明</h2>
|
||||
<p>函数声明包括函数名、形式参数列表、返回值列表(可省略)以及函数体。</p>
|
||||
@@ -620,10 +620,10 @@ func Sin(x float64) float //implemented in assembly language
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5-01.md"
|
||||
@@ -631,7 +631,7 @@ func Sin(x float64) float //implemented in assembly language
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>递归 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h2>5.2. 递归</h2>
|
||||
<p>函数可以是递归的,这意味着函数可以直接或间接的调用自身。对许多问题而言,递归是一种强有力的技术,例如处理递归的数据结构。在4.4节,我们通过遍历二叉树来实现简单的插入排序,在本章节,我们再次使用它来处理HTML文件。</p>
|
||||
@@ -714,10 +714,10 @@ $ ./fetch https://golang.org | ./outline
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5-02.md"
|
||||
@@ -725,7 +725,7 @@ $ ./fetch https://golang.org | ./outline
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>多返回值 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h2>5.3. 多返回值</h2>
|
||||
<p>在Go中,一个函数可以返回多个值。我们已经在之前例子中看到,许多标准库中的函数返回2个值,一个是期望得到的返回值,另一个是函数出错时的错误信息。下面的例子会展示如何编写多返回值的函数。</p>
|
||||
@@ -667,10 +667,10 @@ func countWordsAndImages(n *html.Node) (words, images int) { /* ... */ }
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5-03.md"
|
||||
@@ -678,7 +678,7 @@ func countWordsAndImages(n *html.Node) (words, images int) { /* ... */ }
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>错误 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h2>5.4. 错误</h2>
|
||||
<p>在Go中有一部分函数总是能成功的运行。比如strings.Contains和strconv.FormatBool函数,对各种可能的输入都做了良好的处理,使得运行时几乎不会失败,除非遇到灾难性的、不可预料的情况,比如运行时的内存溢出。导致这种错误的原因很复杂,难以处理,从错误中恢复的可能性也很低。</p>
|
||||
@@ -706,10 +706,10 @@ for {
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5-04.md"
|
||||
@@ -717,7 +717,7 @@ for {
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>函数值 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h2>5.5. 函数值</h2>
|
||||
<p>在Go中,函数被看作第一类值(first-class values):函数像其他值一样,拥有类型,可以被赋值给其他变量,传递给函数,从函数返回。对函数值(function value)的调用类似函数调用。例子如下:</p>
|
||||
@@ -680,10 +680,10 @@ $ ./outline2 http://gopl.io
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5-05.md"
|
||||
@@ -691,7 +691,7 @@ $ ./outline2 http://gopl.io
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>匿名函数 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h2>5.6. 匿名函数</h2>
|
||||
<p>拥有函数名的函数只能在包级语法块中被声明,通过函数字面量(function literal),我们可绕过这一限制,在任何表达式中表示一个函数值。函数字面量的语法和函数声明相似,区别在于func关键字后没有函数名。函数值字面量是一种表达式,它的值被称为匿名函数(anonymous function)。</p>
|
||||
@@ -823,10 +823,10 @@ for i := 0; i < len(dirs); i++ {
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5-06.md"
|
||||
@@ -834,7 +834,7 @@ for i := 0; i < len(dirs); i++ {
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>可变参数 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h2>5.7. 可变参数</h2>
|
||||
<p>参数数量可变的函数称为可变参数函数。典型的例子就是fmt.Printf和类似函数。Printf首先接收一个必备的参数,之后接收任意个数的后续参数。</p>
|
||||
@@ -625,10 +625,10 @@ headings := ElementsByTagName(doc, "h1", "h2", "h3"
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5-07.md"
|
||||
@@ -636,7 +636,7 @@ headings := ElementsByTagName(doc, "h1", "h2", "h3"
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>Deferred函数 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h2>5.8. Deferred函数</h2>
|
||||
<p>在findLinks的例子中,我们用http.Get的输出作为html.Parse的输入。只有url的内容的确是HTML格式的,html.Parse才可以正常工作,但实际上,url指向的内容很丰富,可能是图片,纯文本或是其他。将这些格式的内容传递给html.parse,会产生不良后果。</p>
|
||||
@@ -759,10 +759,10 @@ func fetch(url string) (filename string, n int64, err error) {
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5-08.md"
|
||||
@@ -770,7 +770,7 @@ func fetch(url string) (filename string, n int64, err error) {
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>Panic异常 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h2>5.9. Panic异常</h2>
|
||||
<p>Go的类型系统会在编译时捕获很多错误,但有些错误只能在运行时检查,如数组访问越界、空指针引用等。这些运行时错误会引起panic异常。</p>
|
||||
@@ -678,10 +678,10 @@ src/gopl.io/ch5/defer2/defer.go:15
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5-09.md"
|
||||
@@ -689,7 +689,7 @@ src/gopl.io/ch5/defer2/defer.go:15
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>Recover捕获异常 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h2>5.10. Recover捕获异常</h2>
|
||||
<p>通常来说,不应该对panic异常做任何处理,但有时,也许我们可以从异常中恢复,至少我们可以在程序崩溃前,做一些操作。举个例子,当web服务器遇到不可预料的严重问题时,在崩溃前应该将所有的连接关闭;如果不做任何处理,会使得客户端一直处于等待状态。如果web服务器还在开发阶段,服务器甚至可以将异常信息反馈到客户端,帮助调试。</p>
|
||||
@@ -632,10 +632,10 @@ func soleTitle(doc *html.Node) (title string, err error) {
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5-10.md"
|
||||
@@ -643,7 +643,7 @@ func soleTitle(doc *html.Node) (title string, err error) {
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
44
ch5/ch5.html
44
ch5/ch5.html
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh" class="sidebar-visible no-js light">
|
||||
<head>
|
||||
<!-- Book generated using https://github.com/wa-lang/mnbook -->
|
||||
<!-- Book generated using https://github.com/wa-lang/wabook -->
|
||||
<meta charset="UTF-8">
|
||||
<title>函数 - Go语言圣经</title>
|
||||
<!-- Custom HTML head -->
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
<link rel="icon" href="../favicon.svg">
|
||||
<link rel="shortcut icon" href="../favicon.png">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="../static/wabook/css/variables.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/general.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/chrome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/css/print.css" media="print">
|
||||
<!-- Fonts -->
|
||||
<link rel="stylesheet" href="../static/mnbook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/fonts/fonts.css">
|
||||
<link rel="stylesheet" href="../static/wabook/FontAwesome/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="../static/wabook/fonts/fonts.css">
|
||||
<!-- Highlight.js Stylesheets -->
|
||||
<link rel="stylesheet" href="../static/mnbook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/mnbook/ayu-highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/highlight.css">
|
||||
<link rel="stylesheet" href="../static/wabook/tomorrow-night.css">
|
||||
<link rel="stylesheet" href="../static/wabook/ayu-highlight.css">
|
||||
|
||||
<!-- Custom theme stylesheets -->
|
||||
</head>
|
||||
@@ -36,15 +36,15 @@
|
||||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var theme = localStorage.getItem('mnbook-theme');
|
||||
var sidebar = localStorage.getItem('mnbook-sidebar');
|
||||
var theme = localStorage.getItem('wabook-theme');
|
||||
var sidebar = localStorage.getItem('wabook-sidebar');
|
||||
|
||||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-theme', theme.slice(1, theme.length - 1));
|
||||
localStorage.setItem('wabook-theme', theme.slice(1, theme.length - 1));
|
||||
}
|
||||
|
||||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||||
localStorage.setItem('mnbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
localStorage.setItem('wabook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||||
}
|
||||
} catch (e) { }
|
||||
</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||||
<script type="text/javascript">
|
||||
var theme;
|
||||
try { theme = localStorage.getItem('mnbook-theme'); } catch(e) { }
|
||||
try { theme = localStorage.getItem('wabook-theme'); } catch(e) { }
|
||||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||||
var html = document.querySelector('html');
|
||||
html.classList.remove('no-js')
|
||||
@@ -66,7 +66,7 @@
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mnbook-sidebar'); } catch(e) { }
|
||||
try { sidebar = localStorage.getItem('wabook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
@@ -528,7 +528,7 @@
|
||||
<div class="sidetoc"><nav class="pagetoc"></nav></div>
|
||||
|
||||
<main>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>MnBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/mnbook">https://github.com/wa-lang/mnbook</a></em></li></ul><hr>
|
||||
<ul dir="auto"><li><em>凹语言(Go实现, 面向WASM设计): <a href="https://github.com/wa-lang/wa">https://github.com/wa-lang/wa</a></em></li><li><em>WaBook(Go语言实现的MD电子书构建工具): <a href="https://github.com/wa-lang/wabook">https://github.com/wa-lang/wabook</a></em></li></ul><hr>
|
||||
|
||||
<h1>第5章 函数</h1>
|
||||
<p>函数可以让我们将一个语句序列打包为一个单元,然后可以从程序中其它地方多次调用。函数的机制可以让我们将一个大的工作分解为小的任务,这样的小任务可以让不同程序员在不同时间、不同地方独立完成。一个函数同时对用户隐藏了其实现细节。由于这些因素,对于任何编程语言来说,函数都是一个至关重要的部分。</p>
|
||||
@@ -584,10 +584,10 @@
|
||||
<script type="text/javascript">
|
||||
window.playground_copyable = true;
|
||||
</script>
|
||||
<script src="../static/mnbook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/mnbook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/highlight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/book.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var pagePath = "ch5/ch5.md"
|
||||
@@ -595,7 +595,7 @@
|
||||
|
||||
<!-- Custom JS scripts -->
|
||||
|
||||
<script src="../static/mnbook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../static/wabook/giscus.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user