初始化
This commit is contained in:
commit
4228f447f7
3
01_basics/01_variables/go.mod
Normal file
3
01_basics/01_variables/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module variables
|
||||||
|
|
||||||
|
go 1.23.5
|
16
01_basics/01_variables/main.go
Normal file
16
01_basics/01_variables/main.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// 变量声明与初始化
|
||||||
|
var name string = "Go语言"
|
||||||
|
age := 28 // 类型推断
|
||||||
|
|
||||||
|
// 多变量声明
|
||||||
|
var width, height = 100, 50
|
||||||
|
|
||||||
|
fmt.Println("变量示例:")
|
||||||
|
fmt.Printf("name: %s, age: %d\n", name, age)
|
||||||
|
fmt.Printf("width: %d, height: %d\n", width, height)
|
||||||
|
}
|
3
01_basics/02_data_types/go.mod
Normal file
3
01_basics/02_data_types/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module data_types
|
||||||
|
|
||||||
|
go 1.23.5
|
22
01_basics/02_data_types/main.go
Normal file
22
01_basics/02_data_types/main.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// 基本数据类型示例
|
||||||
|
var (
|
||||||
|
integer int = 42
|
||||||
|
float float64 = 3.14
|
||||||
|
boolean bool = true
|
||||||
|
str string = "Hello"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 复合类型
|
||||||
|
var array [3]int = [3]int{1, 2, 3}
|
||||||
|
slice := []string{"a", "b", "c"}
|
||||||
|
|
||||||
|
fmt.Println("数据类型示例:")
|
||||||
|
fmt.Printf("integer: %d, float: %f, boolean: %t, string: %s\n",
|
||||||
|
integer, float, boolean, str)
|
||||||
|
fmt.Printf("array: %v, slice: %v\n", array, slice)
|
||||||
|
}
|
3
01_basics/03_operators/go.mod
Normal file
3
01_basics/03_operators/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module operators
|
||||||
|
|
||||||
|
go 1.23.5
|
29
01_basics/03_operators/main.go
Normal file
29
01_basics/03_operators/main.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
a, b := 15, 10
|
||||||
|
|
||||||
|
// 算术运算符
|
||||||
|
sum := a + b
|
||||||
|
diff := a - b
|
||||||
|
product := a * b
|
||||||
|
quotient := a / b
|
||||||
|
remainder := a % b
|
||||||
|
|
||||||
|
// 比较运算符
|
||||||
|
eq := a == b
|
||||||
|
gt := a > b
|
||||||
|
lt := a < b
|
||||||
|
|
||||||
|
fmt.Println("运算符示例:")
|
||||||
|
fmt.Printf("%d + %d = %d\n", a, b, sum)
|
||||||
|
fmt.Printf("%d - %d = %d\n", a, b, diff)
|
||||||
|
fmt.Printf("%d * %d = %d\n", a, b, product)
|
||||||
|
fmt.Printf("%d / %d = %d\n", a, b, quotient)
|
||||||
|
fmt.Printf("%d %% %d = %d\n", a, b, remainder)
|
||||||
|
fmt.Printf("%d == %d: %t\n", a, b, eq)
|
||||||
|
fmt.Printf("%d > %d: %t\n", a, b, gt)
|
||||||
|
fmt.Printf("%d < %d: %t\n", a, b, lt)
|
||||||
|
}
|
3
01_basics/04_control_flow/01_conditionals/go.mod
Normal file
3
01_basics/04_control_flow/01_conditionals/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module conditionals
|
||||||
|
|
||||||
|
go 1.23.5
|
25
01_basics/04_control_flow/01_conditionals/main.go
Normal file
25
01_basics/04_control_flow/01_conditionals/main.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
score := 85
|
||||||
|
|
||||||
|
// if-else条件语句
|
||||||
|
if score >= 90 {
|
||||||
|
fmt.Println("优秀")
|
||||||
|
} else if score >= 80 {
|
||||||
|
fmt.Println("良好")
|
||||||
|
} else if score >= 60 {
|
||||||
|
fmt.Println("及格")
|
||||||
|
} else {
|
||||||
|
fmt.Println("不及格")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 带初始化的if语句
|
||||||
|
if num := 9; num%2 == 0 {
|
||||||
|
fmt.Printf("%d是偶数\n", num)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("%d是奇数\n", num)
|
||||||
|
}
|
||||||
|
}
|
3
01_basics/04_control_flow/02_loops/go.mod
Normal file
3
01_basics/04_control_flow/02_loops/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module loops
|
||||||
|
|
||||||
|
go 1.23.5
|
40
01_basics/04_control_flow/02_loops/main.go
Normal file
40
01_basics/04_control_flow/02_loops/main.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// 基本for循环
|
||||||
|
fmt.Println("基本for循环:")
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
fmt.Printf("%d ", i)
|
||||||
|
}
|
||||||
|
fmt.Println()
|
||||||
|
|
||||||
|
// while风格的for循环
|
||||||
|
fmt.Println("\nwhile风格循环:")
|
||||||
|
n := 0
|
||||||
|
for n < 3 {
|
||||||
|
fmt.Printf("%d ", n)
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
fmt.Println()
|
||||||
|
|
||||||
|
// 无限循环
|
||||||
|
fmt.Println("\n无限循环(按条件break):")
|
||||||
|
count := 0
|
||||||
|
for {
|
||||||
|
if count > 3 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
fmt.Printf("%d ", count)
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
fmt.Println()
|
||||||
|
|
||||||
|
// range循环
|
||||||
|
fmt.Println("\nrange循环:")
|
||||||
|
nums := []int{10, 20, 30}
|
||||||
|
for i, num := range nums {
|
||||||
|
fmt.Printf("索引:%d 值:%d\n", i, num)
|
||||||
|
}
|
||||||
|
}
|
3
01_basics/05_functions/01_definition/go.mod
Normal file
3
01_basics/05_functions/01_definition/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module definition
|
||||||
|
|
||||||
|
go 1.23.5
|
31
01_basics/05_functions/01_definition/main.go
Normal file
31
01_basics/05_functions/01_definition/main.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// 基本函数定义
|
||||||
|
func greet(name string) {
|
||||||
|
fmt.Printf("Hello, %s!\n", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 带返回值的函数
|
||||||
|
func add(a, b int) int {
|
||||||
|
return a + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多返回值函数
|
||||||
|
func swap(x, y string) (string, string) {
|
||||||
|
return y, x
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// 调用无返回值函数
|
||||||
|
greet("Gopher")
|
||||||
|
|
||||||
|
// 调用单返回值函数
|
||||||
|
sum := add(3, 5)
|
||||||
|
fmt.Println("3 + 5 =", sum)
|
||||||
|
|
||||||
|
// 调用多返回值函数
|
||||||
|
a, b := swap("hello", "world")
|
||||||
|
fmt.Println(a, b)
|
||||||
|
}
|
3
01_basics/05_functions/02_multiple_returns/go.mod
Normal file
3
01_basics/05_functions/02_multiple_returns/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module multiple_returns
|
||||||
|
|
||||||
|
go 1.23.5
|
39
01_basics/05_functions/02_multiple_returns/main.go
Normal file
39
01_basics/05_functions/02_multiple_returns/main.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 返回计算结果和错误信息
|
||||||
|
func sqrt(x float64) (float64, error) {
|
||||||
|
if x < 0 {
|
||||||
|
return 0, fmt.Errorf("不能对负数 %f 开平方", x)
|
||||||
|
}
|
||||||
|
return math.Sqrt(x), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 命名返回值
|
||||||
|
func split(sum int) (x, y int) {
|
||||||
|
x = sum * 4 / 9
|
||||||
|
y = sum - x
|
||||||
|
return // 裸返回
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// 处理多返回值
|
||||||
|
if result, err := sqrt(16); err != nil {
|
||||||
|
fmt.Println("错误:", err)
|
||||||
|
} else {
|
||||||
|
fmt.Println("平方根:", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理错误情况
|
||||||
|
if _, err := sqrt(-4); err != nil {
|
||||||
|
fmt.Println("错误:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用命名返回值
|
||||||
|
a, b := split(17)
|
||||||
|
fmt.Printf("split(17) = %d, %d\n", a, b)
|
||||||
|
}
|
3
01_basics/05_functions/03_anonymous/go.mod
Normal file
3
01_basics/05_functions/03_anonymous/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module anonymous
|
||||||
|
|
||||||
|
go 1.23.5
|
34
01_basics/05_functions/03_anonymous/main.go
Normal file
34
01_basics/05_functions/03_anonymous/main.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// 立即执行的匿名函数
|
||||||
|
func(msg string) {
|
||||||
|
fmt.Println(msg)
|
||||||
|
}("立即执行的匿名函数")
|
||||||
|
|
||||||
|
// 将匿名函数赋值给变量
|
||||||
|
greet := func(name string) {
|
||||||
|
fmt.Printf("Hello, %s!\n", name)
|
||||||
|
}
|
||||||
|
greet("Gopher")
|
||||||
|
|
||||||
|
// 闭包示例
|
||||||
|
adder := func() func(int) int {
|
||||||
|
sum := 0
|
||||||
|
return func(x int) int {
|
||||||
|
sum += x
|
||||||
|
return sum
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用闭包
|
||||||
|
pos, neg := adder(), adder()
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
fmt.Println(
|
||||||
|
"pos:", pos(i),
|
||||||
|
"neg:", neg(-2*i),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
3
01_basics/06_packages/go.mod
Normal file
3
01_basics/06_packages/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module packages
|
||||||
|
|
||||||
|
go 1.21
|
13
01_basics/06_packages/main.go
Normal file
13
01_basics/06_packages/main.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"packages/myutils" // 导入自定义包
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// 调用外部包中的函数
|
||||||
|
myutils.Greet("Gopher")
|
||||||
|
|
||||||
|
fmt.Println("包导入和使用示例")
|
||||||
|
}
|
13
01_basics/06_packages/myutils/utils.go
Normal file
13
01_basics/06_packages/myutils/utils.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package myutils
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// 首字母大写的函数才能被外部包访问
|
||||||
|
func Greet(name string) {
|
||||||
|
fmt.Printf("Hello, %s!\n", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 小写函数只能在包内使用
|
||||||
|
func internalFunc() {
|
||||||
|
fmt.Println("This is internal")
|
||||||
|
}
|
21
02_core_concepts/01_pointers/main.go
Normal file
21
02_core_concepts/01_pointers/main.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// 基本指针操作
|
||||||
|
a := 42
|
||||||
|
p := &a // 获取a的地址
|
||||||
|
|
||||||
|
fmt.Printf("a的值: %d, 地址: %p\n", a, p)
|
||||||
|
fmt.Printf("通过指针访问值: %d\n", *p)
|
||||||
|
|
||||||
|
// 通过指针修改值
|
||||||
|
*p = 100
|
||||||
|
fmt.Printf("修改后a的值: %d\n", a)
|
||||||
|
|
||||||
|
// 指针的指针
|
||||||
|
pp := &p
|
||||||
|
fmt.Printf("指针的指针: %p\n", pp)
|
||||||
|
fmt.Printf("通过指针的指针访问值: %d\n", **pp)
|
||||||
|
}
|
3
02_core_concepts/02_structs/go.mod
Normal file
3
02_core_concepts/02_structs/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module structs
|
||||||
|
|
||||||
|
go 1.21
|
5
02_core_concepts/02_structs/main.go
Normal file
5
02_core_concepts/02_structs/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
02_core_concepts/03_interfaces/go.mod
Normal file
3
02_core_concepts/03_interfaces/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module interfaces
|
||||||
|
|
||||||
|
go 1.21
|
5
02_core_concepts/03_interfaces/main.go
Normal file
5
02_core_concepts/03_interfaces/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
02_core_concepts/04_error_handling/go.mod
Normal file
3
02_core_concepts/04_error_handling/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module error_handling
|
||||||
|
|
||||||
|
go 1.21
|
5
02_core_concepts/04_error_handling/main.go
Normal file
5
02_core_concepts/04_error_handling/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
02_core_concepts/05_concurrency/01_goroutines/go.mod
Normal file
3
02_core_concepts/05_concurrency/01_goroutines/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module goroutines
|
||||||
|
|
||||||
|
go 1.21
|
5
02_core_concepts/05_concurrency/01_goroutines/main.go
Normal file
5
02_core_concepts/05_concurrency/01_goroutines/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
02_core_concepts/05_concurrency/02_channels/go.mod
Normal file
3
02_core_concepts/05_concurrency/02_channels/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module channels
|
||||||
|
|
||||||
|
go 1.21
|
5
02_core_concepts/05_concurrency/02_channels/main.go
Normal file
5
02_core_concepts/05_concurrency/02_channels/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
02_core_concepts/05_concurrency/03_sync_pkg/go.mod
Normal file
3
02_core_concepts/05_concurrency/03_sync_pkg/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module sync_pkg
|
||||||
|
|
||||||
|
go 1.21
|
5
02_core_concepts/05_concurrency/03_sync_pkg/main.go
Normal file
5
02_core_concepts/05_concurrency/03_sync_pkg/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
03_std_lib/01_fmt/go.mod
Normal file
3
03_std_lib/01_fmt/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module fmt
|
||||||
|
|
||||||
|
go 1.23.5
|
BIN
03_std_lib/01_fmt/main.go
Normal file
BIN
03_std_lib/01_fmt/main.go
Normal file
Binary file not shown.
3
03_std_lib/02_os/go.mod
Normal file
3
03_std_lib/02_os/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module os
|
||||||
|
|
||||||
|
go 1.21
|
5
03_std_lib/02_os/main.go
Normal file
5
03_std_lib/02_os/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
03_std_lib/03_io/go.mod
Normal file
3
03_std_lib/03_io/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module io
|
||||||
|
|
||||||
|
go 1.21
|
5
03_std_lib/03_io/main.go
Normal file
5
03_std_lib/03_io/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
03_std_lib/04_net_http/go.mod
Normal file
3
03_std_lib/04_net_http/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module net_http
|
||||||
|
|
||||||
|
go 1.21
|
5
03_std_lib/04_net_http/main.go
Normal file
5
03_std_lib/04_net_http/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
03_std_lib/05_encoding_json/go.mod
Normal file
3
03_std_lib/05_encoding_json/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module encoding_json
|
||||||
|
|
||||||
|
go 1.21
|
5
03_std_lib/05_encoding_json/main.go
Normal file
5
03_std_lib/05_encoding_json/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
03_std_lib/06_testing/go.mod
Normal file
3
03_std_lib/06_testing/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module testing
|
||||||
|
|
||||||
|
go 1.21
|
5
03_std_lib/06_testing/main.go
Normal file
5
03_std_lib/06_testing/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
04_tools/01_go_mod/go.mod
Normal file
3
04_tools/01_go_mod/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module go_mod
|
||||||
|
|
||||||
|
go 1.21
|
5
04_tools/01_go_mod/main.go
Normal file
5
04_tools/01_go_mod/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
04_tools/02_go_test/go.mod
Normal file
3
04_tools/02_go_test/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module go_test
|
||||||
|
|
||||||
|
go 1.21
|
5
04_tools/02_go_test/main.go
Normal file
5
04_tools/02_go_test/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
04_tools/03_go_vet/go.mod
Normal file
3
04_tools/03_go_vet/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module go_vet
|
||||||
|
|
||||||
|
go 1.21
|
5
04_tools/03_go_vet/main.go
Normal file
5
04_tools/03_go_vet/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
04_tools/04_go_fmt/go.mod
Normal file
3
04_tools/04_go_fmt/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module go_fmt
|
||||||
|
|
||||||
|
go 1.21
|
5
04_tools/04_go_fmt/main.go
Normal file
5
04_tools/04_go_fmt/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
04_tools/05_debug_tools/go.mod
Normal file
3
04_tools/05_debug_tools/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module debug_tools
|
||||||
|
|
||||||
|
go 1.21
|
5
04_tools/05_debug_tools/main.go
Normal file
5
04_tools/05_debug_tools/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
05_advanced/01_reflection/go.mod
Normal file
3
05_advanced/01_reflection/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module reflection
|
||||||
|
|
||||||
|
go 1.21
|
5
05_advanced/01_reflection/main.go
Normal file
5
05_advanced/01_reflection/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
05_advanced/02_performance/go.mod
Normal file
3
05_advanced/02_performance/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module performance
|
||||||
|
|
||||||
|
go 1.21
|
5
05_advanced/02_performance/main.go
Normal file
5
05_advanced/02_performance/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
05_advanced/03_memory_management/go.mod
Normal file
3
05_advanced/03_memory_management/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module memory_management
|
||||||
|
|
||||||
|
go 1.21
|
5
05_advanced/03_memory_management/main.go
Normal file
5
05_advanced/03_memory_management/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
05_advanced/04_network_programming/go.mod
Normal file
3
05_advanced/04_network_programming/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module network_programming
|
||||||
|
|
||||||
|
go 1.21
|
5
05_advanced/04_network_programming/main.go
Normal file
5
05_advanced/04_network_programming/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
05_advanced/05_database/go.mod
Normal file
3
05_advanced/05_database/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module database
|
||||||
|
|
||||||
|
go 1.21
|
5
05_advanced/05_database/main.go
Normal file
5
05_advanced/05_database/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
06_projects/01_cli_tool/go.mod
Normal file
3
06_projects/01_cli_tool/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module cli_tool
|
||||||
|
|
||||||
|
go 1.21
|
5
06_projects/01_cli_tool/main.go
Normal file
5
06_projects/01_cli_tool/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
06_projects/02_web_service/go.mod
Normal file
3
06_projects/02_web_service/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module web_service
|
||||||
|
|
||||||
|
go 1.21
|
5
06_projects/02_web_service/main.go
Normal file
5
06_projects/02_web_service/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
06_projects/03_crawler/go.mod
Normal file
3
06_projects/03_crawler/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module crawler
|
||||||
|
|
||||||
|
go 1.21
|
5
06_projects/03_crawler/main.go
Normal file
5
06_projects/03_crawler/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
06_projects/04_microservice/go.mod
Normal file
3
06_projects/04_microservice/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module microservice
|
||||||
|
|
||||||
|
go 1.21
|
5
06_projects/04_microservice/main.go
Normal file
5
06_projects/04_microservice/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
3
06_projects/05_distributed_system/go.mod
Normal file
3
06_projects/05_distributed_system/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module distributed_system
|
||||||
|
|
||||||
|
go 1.21
|
5
06_projects/05_distributed_system/main.go
Normal file
5
06_projects/05_distributed_system/main.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO
|
||||||
|
}
|
53
go_learning_roadmap.md
Normal file
53
go_learning_roadmap.md
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# Go语言学习路线图
|
||||||
|
|
||||||
|
## 基础语法
|
||||||
|
- 变量与常量
|
||||||
|
- 数据类型
|
||||||
|
- 运算符
|
||||||
|
- 流程控制
|
||||||
|
- 条件语句
|
||||||
|
- 循环语句
|
||||||
|
- 函数
|
||||||
|
- 定义与调用
|
||||||
|
- 多返回值
|
||||||
|
- 匿名函数
|
||||||
|
- 包管理
|
||||||
|
|
||||||
|
## 核心概念
|
||||||
|
- 指针
|
||||||
|
- 结构体
|
||||||
|
- 接口
|
||||||
|
- 错误处理
|
||||||
|
- 并发编程
|
||||||
|
- Goroutine
|
||||||
|
- Channel
|
||||||
|
- sync包
|
||||||
|
|
||||||
|
## 标准库
|
||||||
|
- fmt
|
||||||
|
- os
|
||||||
|
- io
|
||||||
|
- net/http
|
||||||
|
- encoding/json
|
||||||
|
- testing
|
||||||
|
|
||||||
|
## 工具链
|
||||||
|
- go mod
|
||||||
|
- go test
|
||||||
|
- go vet
|
||||||
|
- go fmt
|
||||||
|
- 调试工具
|
||||||
|
|
||||||
|
## 进阶主题
|
||||||
|
- 反射
|
||||||
|
- 性能优化
|
||||||
|
- 内存管理
|
||||||
|
- 网络编程
|
||||||
|
- 数据库操作
|
||||||
|
|
||||||
|
## 实战项目
|
||||||
|
1. 命令行工具
|
||||||
|
2. Web服务
|
||||||
|
3. 爬虫程序
|
||||||
|
4. 微服务
|
||||||
|
5. 分布式系统
|
Loading…
x
Reference in New Issue
Block a user