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

内置接口类型 error 无法解析 #96

Closed
Sgmwei opened this issue Apr 9, 2024 · 5 comments
Closed

内置接口类型 error 无法解析 #96

Sgmwei opened this issue Apr 9, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Sgmwei
Copy link

Sgmwei commented Apr 9, 2024

darwin/arm64 (macbook m1 air)
golang1.21.8

type (
	IDo interface {
		Do() error
	}
	Struct1 struct{}
)

func (Struct1) Do() error {
	fmt.Print("DO SOMETHING\n")
	return nil
}

func NewStructX() IDo {
	return Struct1{}
}

加载上述测试文件将报错unresolve external:type:error

eh-steve pushed a commit to eh-steve/goloader that referenced this issue Apr 9, 2024
eh-steve pushed a commit to eh-steve/goloader that referenced this issue Apr 9, 2024
@mwat56
Copy link

mwat56 commented Apr 9, 2024 via email

@Sgmwei
Copy link
Author

Sgmwei commented Apr 10, 2024

not only a type.

Tks for pointing out my grammar is not complete, but this does not affect the occurrence of errors.

by the way, goloader 's version is github.com/pkujhd/goloader v0.0.0-20240302083706-9af26f1bc5bc, and the occurrence happend at addSymbolMap (/github.com/pkujhd/goloader@v0.0.0-20240302083706-9af26f1bc5bc/ld.go:378) when i debug symPtr can't find the key 'type:error', which in linker.SymMap need to use.

@eh-steve
Copy link

Seems to work on my fork… eh-steve@d53913e

@pkujhd pkujhd closed this as completed in 1a28096 Apr 11, 2024
@pkujhd
Copy link
Owner

pkujhd commented Apr 11, 2024

Seems to work on my fork… eh-steve@d53913e

When registering a type without a package name, registerType() will resolve its name. but when this type is an interface, it get a different name.

type:error is an internal interface without a package name. registerType get a wrong name("Interface { Error() string }")

@eh-steve Steve's fork works because this version will attempt to handle undefined symbols. It copys type:error from runtime.a again.

@Sgmwei
Copy link
Author

Sgmwei commented Apr 11, 2024

Seems to work on my fork… eh-steve@d53913e

When registering a type without a package name, registerType() will resolve its name. but when this type is an interface, it get a different name.  type:error is an internal interface without a package name. registerType get a wrong name("Interface { Error() string }")  @eh-steve Steve's fork works because this version will attempt to handle undefined symbols. It copys type:error from runtime.a again.

So what's your suggest if I want to continue using your branch ?😯

@pkujhd pkujhd added the bug Something isn't working label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants