初始化
This commit is contained in:
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
|
||||
}
|
Reference in New Issue
Block a user