go - 很奇怪的问题函数正常运行不会报错但是在debug模式下启动会报错
问题描述
直接运行是没有错误的 调试程序的时候第二次进入递归函数就报错 不要跳过方法进入方法 这是我的函数ok 很奇怪的问题
type Student struct {
Name string
//排序
Sort int
//parent
Parent int
//level
Level int
Id int
}
func main() {
var data []Student = []Student{
{Name: "家用电器", Sort: 1, Parent: 0, Level: 1, Id: 1},
{Name: "电脑办公", Sort: 2, Parent: 0, Level: 1, Id: 2},
{Name: "男装", Sort: 3, Parent: 0, Level: 1, Id: 3},
{Name: "手机", Sort: 1, Parent: 2, Level: 2, Id: 4},
{Name: "数码", Sort: 2, Parent: 1, Level: 2, Id: 5},
{Name: "汽车", Sort: 3, Parent: 1, Level: 2, Id: 6},
{Name: "男装2", Sort: 1, Parent: 3, Level: 2, Id: 7},
{Name: "男装2下层皮裤", Sort: 1, Parent: 7, Level: 3, Id: 8},
{Name: "汽车2下层拖拉机", Sort: 1, Parent: 6, Level: 3, Id: 9},
}
result := make([]Student, len(data))
flag := make([]bool, len(data))
index := 0
FindTest(&result, data, flag, 1, 0, &index)
}
//exception
0 {家用电器 1 0 1 1}
Exception 0xc000001d 0x0 0x0 0x4bb723
PC=0x4bb723
main.FindTest(0xc000089d58, 0xc000089da0, 0x9, 0x9, 0xc00000a0d0, 0x9, 0x9, 0x2, 0x1, 0xc000089d40)
F:/golang/gostu/ptr/chan2.go:36 +0x573
main.FindTest(0xc000089d58, 0xc000089da0, 0x9, 0x9, 0xc00000a0d0, 0x9, 0x9, 0x1, 0x0, 0xc000089d40)
F:/golang/gostu/ptr/chan2.go:47 +0x465
main.main()
F:/golang/gostu/ptr/chan2.go:32 +0x184
rax 0xc000089b10
rbx 0xc000089880
rcx 0xc000036000
rdi 0xc00008e008
rsi 0x19
rbp 0xc000089ce0
rsp 0xc000089bb8
r8 0x83fd88
r9 0xc0000896e0
解决方案
推荐阅读
- xcode - 找不到 RCTPushNotification.xcodeproj
- jenkins - 如何通过 Jenkins 声明式管道脚本加载 Groovy 文件并在其中调用方法
- c# - .NET MVC 路由在菜单控制器上重定向到特定控制器
- linux - 想知道我是否可以在它执行时应用加载,这可能吗?
- java - 我怎样才能通过列表
进入可变参数方法 - python - 错误:OpenCV(4.1.2)/io/opencv/modules/imgcodecs/src/loadsave.cpp:715:错误:(-215:断言失败)!_img.empty()在函数'imwrite'中
- python - 如何为具有可以访问主 GUI 功能的子窗口/类的窗口创建 GUI 类?
- android - Sqlite如何提高性能?
- python - Pydantic验证器删除空白字符串?
- c - 我想按字母顺序对结构进行排序,但如果我进行排序,我的程序不会给出任何输出