Skip to content

Commit 2aa6d8e

Browse files
authored
Merge pull request #33 from shipengqi/feat/new-theme
feat(theme): use hextra theme
2 parents 3d4d1f1 + e9193ef commit 2aa6d8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+342
-322
lines changed

.github/workflows/gh-pages.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ jobs:
2323
- name: Setup Hugo
2424
uses: peaceiris/actions-hugo@v3
2525
with:
26-
hugo-version: '0.119.0'
26+
hugo-version: '0.139.0'
2727
extended: true
2828

2929
- name: Build
30-
run: hugo -t book --minify
30+
run: hugo --minify
3131

3232
- name: Deploy
3333
uses: peaceiris/actions-gh-pages@v4
3434
if: github.ref == 'refs/heads/master'
3535
with:
3636
github_token: ${{ secrets.PAT }}
37-
publish_dir: ./public
37+
publish_dir: ./public

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,27 @@ Go language learning ...
44

55
## Usage
66

7-
Development:
7+
Initialize project as a Hugo Module using the `hugo mod init` command:
88

99
```sh
10-
# init submodule, set the URLs and paths of the submodules based on the information in the .gitmodules file,
11-
# but will not download the submodule's content
12-
# after cloning a repository containing submodules, run this command to initialize the submodules.
13-
git submodule init
10+
hugo mod init github.com/shipengqi/golang-learn
11+
```
12+
13+
Adding the [Hextra](https://github.com/imfing/hextra) theme:
14+
15+
```yaml
16+
baseURL: "https://shipengqi.github.io/golang-learn"
17+
title: "Golang Learning"
1418

15-
# Update the submodule's content to the latest commit in the branch specified in the .gitmodules file
16-
# Run this command after initializing a submodule, or when you need to update the contents of a submodule.
17-
git submodule update
19+
module:
20+
imports:
21+
- path: github.com/imfing/hextra
22+
```
1823
19-
# git submodule add [email protected]:alex-shpak/hugo-book.git themes/book
24+
Start server:
2025
21-
# start server
22-
hugo server --minify --theme book
26+
```sh
27+
hugo server -D
2328
```
2429

2530
Manually deploy:
@@ -30,7 +35,16 @@ Manually deploy:
3035

3136
> Any changes in the `content` directory will automatically trigger a deployment.
3237
33-
## Menu
38+
## Update Theme
39+
40+
To update all Hugo modules in your project to their latest versions, run the following command:
3441

35-
By default, the [hugo-book](https://github.com/alex-shpak/hugo-book) theme will render pages from the `content/docs` section as a menu in a tree structure.
36-
You can set `title` and `weight` in the front matter of pages to adjust the order and titles in the menu.
42+
```
43+
hugo mod get -u
44+
```
45+
46+
To update Hextra to the latest released version, run the following command:
47+
48+
```
49+
hugo mod get -u github.com/imfing/hextra
50+
```

config.yaml

Lines changed: 0 additions & 107 deletions
This file was deleted.

content/_index.md

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,16 @@
11
---
2-
title: 主要内容
2+
title: Go Learning
33
---
44

5-
# Go Learning
6-
75
## 主要内容
86

9-
{{< columns >}}
10-
11-
### 🍚 Go 语言基础
12-
13-
Go 的基本数据类型,关键字的使用和原理。
14-
15-
<--->
16-
17-
### ⚡ Go 并发编程
18-
19-
Go 常见的并发原语的使用和原理。
20-
21-
{{< /columns >}}
22-
23-
24-
{{< columns >}}
25-
26-
### 🛠️ Go 实践
27-
28-
记录了编译优化,性能优化,测试, debug,性能分析,工程实践等。
29-
30-
<--->
31-
32-
### 🔍 Go 底层原理
33-
34-
Go 底层内存管理,GC,调度器的实现原理。
7+
{{< cards cols="2" >}}
8+
{{< card link="/golang-learn/docs/basic" title="Go 语言基础" icon="code" subtitle="Go 的基本数据类型,关键字的使用和原理。" >}}
9+
{{< card link="/golang-learn/docs/concurrency" title="Go 并发编程" icon="color-swatch" subtitle="Go 常见的并发原语的使用和原理。" >}}
10+
{{< card link="/golang-learn/docs/practice" title="Go 实践" icon="cube" subtitle="记录了编译优化,性能优化,测试, debug,性能分析,工程实践等。" >}}
11+
{{< card link="/golang-learn/docs/advance" title="Go 底层原理" icon="beaker" subtitle="Go 底层内存管理,GC,调度器的实现原理。" >}}
12+
{{< /cards >}}
3513

36-
{{< /columns >}}
3714

3815
## 互动与勘误
3916

@@ -48,4 +25,4 @@ Go 底层内存管理,GC,调度器的实现原理。
4825
- [Go 语言设计与实现](https://draveness.me/golang/)
4926
- [Go 程序员面试笔试宝典](https://golang.design/go-questions/)
5027
- [Go 语言必知必会](https://golang.dbwu.tech/)
51-
- [Go 语言高性能编程](https://geektutu.com/post/high-performance-go.html)
28+
- [Go 语言高性能编程](https://geektutu.com/post/high-performance-go.html)

content/docs/basic/02_array.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: 数组
33
weight: 2
44
---
55

6-
# 数组
7-
86
数组是一个由**固定长度****相同类型的元素**组成的数据结构。计算机会为数组分配一块**连续的内存**来保存其中的元素,并且可以利用**索引**快速访问数组中的元素。
97

108
## 初始化
@@ -21,4 +19,4 @@ arr2 := [...]int{1, 2, 3} // `...` 省略号,表示数组的长度是根据初
2119
根据数组大小:
2220

2321
- 当元素数量小于或者等于 4 个时,会直接将数组中的元素放置在栈上。
24-
- 当元素数量大于 4 个时,会将数组中的元素放置到静态区,并在运行时取出。
22+
- 当元素数量大于 4 个时,会将数组中的元素放置到静态区,并在运行时取出。

content/docs/basic/03_slice.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: 切片
33
weight: 3
44
---
55

6-
# 切片
7-
86
切片 (slice) 在使用上和数组差不多,区别是切片是**可变长**的,定义的时候不需要指定 size。
97

108
切片可以看做是对数组的一层简单的封装,切片的底层数据结构中,包含了一个数组。

content/docs/basic/04_map.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: 哈希表
33
weight: 4
44
---
55

6-
# 哈希表
7-
86
`map` 是一个无序的 `key/value` 对的集合,同一个 key 只会出现一次。
97

108
## 哈希表的设计原理

content/docs/basic/05_function.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: 函数
33
weight: 5
44
---
55

6-
# 函数
7-
86
## 参数传递
97

108
函数的参数传递有两种方式:

content/docs/basic/06_interface.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ weight: 6
44
draft: true
55
---
66

7-
# 接口
8-
97
Go 支持接口数据类型,接口是一组方法的集合,任何其他类型只要实现了这些方法就是实现了这个接口,无须显示声明。
108

119
**接口只有当有两个或两个以上的具体类型必须以相同的方式进行处理时才需要**。比如写单元测试,需要 mock 一个类型时,就可以使用接口,mock 的类型和被测试的类型都实现同一个接口即可。
@@ -132,4 +130,4 @@ func main() {
132130
}
133131
```
134132

135-
匿名接口的优点,**匿名接口的方式不依赖具体实现,可以对任意实现了该接口的类型进行重写**
133+
匿名接口的优点,**匿名接口的方式不依赖具体实现,可以对任意实现了该接口的类型进行重写**

content/docs/basic/07_reflect.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ weight: 7
44
draft: true
55
---
66

7-
# 反射
8-
97
**反射机制,能够在运行时更新变量和检查它们的值、调用它们的方法和它们支持的内在操作,而不需要在编译时就知道
108
这些变量的具体类型**。弥补了静态语言在动态行为上的一些不足。
119

@@ -91,4 +89,4 @@ func TestSumAll(t *testing.T) {
9189
}
9290
}
9391
```
94-
尝试比较 `slice``string`。这显然是不合理的,但是却通过了测试。所以使用 `reflect.DeepEqual` 比较简洁但是在使用时需多加小心。
92+
尝试比较 `slice``string`。这显然是不合理的,但是却通过了测试。所以使用 `reflect.DeepEqual` 比较简洁但是在使用时需多加小心。

content/docs/basic/08_generic.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@ weight: 8
44
draft: true
55
---
66

7-
# 泛型
8-
9-
Coming soon ...
7+
Coming soon ...

content/docs/basic/09_pointer.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: 指针
33
weight: 9
44
---
55

6-
# 指针
7-
86
**指针和内存地址不能混为一谈**。内存地址是内存中每个字节单元的唯一编号,而指针是一个实体。指针也会分配内存空间,相当于一个保存内存地址的整形变量。
97

108
## 指针的限制
@@ -93,4 +91,4 @@ func main() {
9391
fmt.Println(reflect.TypeOf(p)) // *unit
9492
fmt.Println(*p) // 11
9593
}
96-
```
94+
```

content/docs/basic/10_range.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ weight: 10
44
draft: true
55
---
66

7-
# range
8-
97
带有 `range` 子句的 `for` 语句会先把被遍历的字符串值拆成一个**字节序列**(注意是字节序列),然后再试图找出这个字节序列中
108
包含的每一个 UTF-8 编码值,或者说每一个 Unicode 字符。
119

content/docs/basic/11_select.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ weight: 11
44
draft: true
55
---
66

7-
# select
8-
97
`select` 类似于用于通信的 `switch` 语句。每个 `case` 必须是一个通信操作,要么是发送要么是接收。
108

119
当条件满足时,`select` 会去通信并执行 `case` 之后的语句,这时候其它通信是不会执行的。
@@ -181,4 +179,4 @@ select {
181179
```
182180

183181
上面的代码 `select` 语句只有一个候选分支,我在其中利用接收表达式的第二个结果值对 `intChan` 通道是否已关闭做了判断,并在
184-
得到肯定结果后,通过 `break` 语句立即结束当前 `select` 语句的执行。
182+
得到肯定结果后,通过 `break` 语句立即结束当前 `select` 语句的执行。

content/docs/basic/12_defer.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ weight: 12
44
draft: true
55
---
66

7-
# defer
8-
97
#### 堆上分配
108

119
编译器不仅将 defer 关键字都转换成 runtime.deferproc 函数,它还会通过以下三个步骤为所有调用 defer 的函数末尾插入 runtime.deferreturn 的函数调用
@@ -296,4 +294,4 @@ func main() {
296294
这个队列与该 `defer` 语句所属的函数是对应的,并且,它是先进后出(FILO)的,相当于一个栈。
297295

298296
在需要执行某个函数中的 `defer` 函数调用的时候,Go 语言会先拿到对应的队列,然后从该队列中一个一个地取出 `defer` 函数及
299-
其参数值,并逐个执行调用。
297+
其参数值,并逐个执行调用。

0 commit comments

Comments
 (0)