ginrpc icon indicating copy to clipboard operation
ginrpc copied to clipboard

Arm64 run panic: package parsing failed:can not find main files "runtime/asm_amd64.s"

Open peterSZW opened this issue 2 years ago • 2 comments

if strings.HasSuffix(filename, "runtime/asm_amd64.s") {
				index = index - 2
				break
			}
			index++

asm_amd64 is not correct in arm64 platform !

panic: package parsing failed:can not find main files

goroutine 1 [running]: github.com/xxjwxc/public/myast.GetModuleInfo(0x2, 0x40000740d8, 0x400042baa8, 0x89198, 0x0, 0xe24dc) /go/pkg/mod/github.com/xxjwxc/[email protected]/myast/common.go:42 +0x36c github.com/xxjwxc/ginrpc.(_Base).tryGenRegister(0x40003a0190, 0x8588a0, 0x40003b01a0, 0x400042bea8, 0x1, 0x1, 0x40003a0190) /go/pkg/mod/github.com/xxjwxc/[email protected]/common.go:455 +0x30 github.com/xxjwxc/ginrpc.(_Base).Register(0x40003a0190, 0x8588a0, 0x40003b01a0, 0x400042bea8, 0x1, 0x1, 0x40003b01a0) /go/pkg/mod/github.com/xxjwxc/[email protected]/ginrpc.go:152 +0x9c

peterSZW avatar Jun 03 '21 16:06 peterSZW

modify code like below, it works

vi /go/pkg/mod/github.com/xxjwxc/[email protected]/myast/common.go

        for { // find main file
                _, filename, _, ok := runtime.Caller(index)
                if ok {
                        fmt.Println(filename)
                        if strings.HasSuffix(filename, "runtime/asm_amd64.s") {
                                index = index - 2
                                break
                        }
                        if strings.HasSuffix(filename, "runtime/asm_arm64.s") {
                                index = index - 2
                                break
                        }
                        index++
                } else {
                        panic(errors.New("package parsing failed:can not find m........
                }
        }

peterSZW avatar Jun 03 '21 16:06 peterSZW

@peterSZW 感谢,请提一个pr,我来合并

xxjwxc avatar Jun 03 '21 17:06 xxjwxc