Skip to content

Commit

Permalink
使用 docsify 结构化文档内容
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Liu committed Oct 12, 2019
1 parent 1b46217 commit a7388a3
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 8 deletions.
Empty file added .nojekyll
Empty file.
9 changes: 1 addition & 8 deletions 0.9.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### 0.9 go fmt与gofmt
# go fmt与gofmt


`go fmt`命令会按照Go语言代码规范格式化指定代码包中的所有Go语言源码文件的代码,所有Go语言源码文件即包括命令源码文件、库源码文件和测试源码文件。注意,当代码包还有子代码包时,子代码包中的Go语言源码文件是不包含在内的。也就是说,`go fmt`命令只会格式化被直接保存在指定代码包对应目录下的Go语言源码文件。
Expand Down Expand Up @@ -95,10 +95,3 @@ if a == "print" {
```
由上述示例可知,我们可以使用`gofmt`命令的交互模式格式化任意的代码片段。虽然会显示一行警告信息,但是格式化后的结果仍然会被打印出来。并且,在交互模式下,当我们输入的代码片段不符合Go语言的语法规则时,命令程序也会打印出错误提示信息。在其它方面,命令程序在交互模式与普通模式下的行为也是基本一致的。
## links
* [目录](catalog.md)
* 上一节: [go list](0.8.md)
* 下一节: [go fix与go tool fix](0.10.md)
30 changes: 30 additions & 0 deletions _sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
* [标志命令详解](0.0)

* [go build](0.1)

* [go install](0.2)

* [go get](0.3)

* [go clean](0.4)

* [go doc 与 godoc](0.5)

* [go run](0.6)

* [go test](0.7)

* [go list](0.8)

* [go fmt 与 gofmt](0.9)

* [go fix 与 go tool fix](0.10)

* [go vet 与 go tool vet](0.11)

* [go tool pprof](0.12)

* [go tool cgo](0.13)

* [go env](0.14)

76 changes: 76 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Go 命令教程</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<!-- 在 GitHub 上编辑 -->
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<!-- 自定义样式 -->
<style>
.sidebar li>p a {
font-weight: 700;
}
.sidebar ul p.active>a {
border-right: 2px solid;
color: var(--theme-color,#42b983);
}
</style>
<script src="//unpkg.com/docsify-edit-on-github/index.js"></script>
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
name: 'Go 命令教程',
repo: 'hyper0x/go_command_tutorial',
loadSidebar: true,
auto2top: true,
// 全文搜索配置
search: {
paths: 'auto', // or 'auto'
placeholder: '输入关键词搜索',
noData: '找不到结果'
},
pagination: {
previousText: '上一节',
nextText: '下一节',
crossChapter: false
},
plugins: [
EditOnGithubPlugin.create(
'https://github.com/hyper0x/go_command_tutorial/blob/master/',
undefined,
'在 GitHub 上编辑本页'
),
function(hook) {
var footer = [
'<footer>',
'<span>Powered by <a href="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/docsifyjs/docsify" target="_blank">docsify</a>.</span>',
'</footer>'
].join('');

hook.afterEach(function(html) {
return html + footer;
});
}
]
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<!-- 语言高亮 -->
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<!-- 全文搜索 -->
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
<!-- emoji 支持 -->
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
<!-- 复制到剪贴板 -->
<script src="//unpkg.com/docsify-copy-code"></script>
<!-- 图片缩放 -->
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.js"></script>
<!-- 分页 -->
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
</body>
</html>

0 comments on commit a7388a3

Please sign in to comment.