Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.1.3 定义字符串变量,解决pkgpath.NameData: missing Go type information for global symbol: size 8 错误存在问题 #521

Open
XiaodongLoong opened this issue Sep 7, 2020 · 5 comments

Comments

@XiaodongLoong
Copy link

我发现只需要在pkg.go 文件里面加入var NameData [8]byte就可以了,而不需要其他的修改,具体修改如下:

package pkg

+ var NameData [8]byte
var Name string

https://github.com/chai2010/advanced-go-programming-book/blob/master/ch3-asm/ch3-01-basic.md

@XiaodongLoong
Copy link
Author

XiaodongLoong commented Sep 7, 2020

I apply the above change, and run it.
on mips64le :

[loongson@localhost string]$ go run cmd/main.go 
gopher
[loongson@localhost string]$

on x86_64:

[root@iz2zebexqcz69hfh1b5avwz string]# go run cmd/main.go 

[root@iz2zebexqcz69hfh1b5avwz string]# ls

So there are some difference between mips64le and X86_64.

@cch123
Copy link
Collaborator

cch123 commented Sep 8, 2020

汇编不跨平台太正常了

@gamelee
Copy link

gamelee commented Sep 21, 2021

我在 go 1.17 发现 string 第二种写法也需要加 NOPTR 了

@mstmdev
Copy link
Contributor

mstmdev commented Jul 13, 2022

我在 go 1.17 发现 string 第二种写法也需要加 NOPTR 了

对于此类版本兼容性问题,是否应该对内容进行修订,直接删除新版本不再兼容的写法或者在文中标注该写法支持的版本?

@qshuai
Copy link

qshuai commented Jul 15, 2024

我在 go 1.17 发现 string 第二种写法也需要加 NOPTR 了

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants