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

Deprecated function Call.PC() breaks tinygo compatibility? #31

Open
dkegel-fastly opened this issue Nov 12, 2021 · 3 comments
Open

Deprecated function Call.PC() breaks tinygo compatibility? #31

dkegel-fastly opened this issue Nov 12, 2021 · 3 comments

Comments

@dkegel-fastly
Copy link

Following a rabbit hole of dependencies that starts at tinygo-org/tinygo#2153, I noticed that

$ git clone https://github.com/go-stack/stack
$ cd stack
$ go test

succeeds, but

$ tinygo test

fails with

stack.go:164:17: c.frame.PC undefined (type runtime.Frame has no field or method PC)

That's

162 // Deprecated: Use Call.Frame instead.
163 func (c Call) PC() uintptr {
164         return c.frame.PC
165 }

So for what it's worth, the deprecated function Call.PC() is causing tinygo build failure. Commenting it out lets tinygo test pass.

@ChrisHines
Copy link
Member

Indeed. Tinygo's runtime.Frame type is not fully compatible with Go's runtime.Frame type. It is missing several fields.

The best solution here is to move func (c Call) PC() uintptr into a separate file that specifies a !tinygo build tag.

Would you like to submit a PR for that?

@dkegel-fastly
Copy link
Author

I must have been smoking something. Fixing that one problem uncovers another one now:

stack_test.go:580:6: fn.FileLine undefined (type *runtime.Func has no field or method FileLine)

so maybe it's best to leave sleeping dogs lie for a bit, until the need for a fix is stronger.

@ChrisHines
Copy link
Member

Sure. Tinygo's runtime package is quite a bit smaller than Go's, so any code that depends on runtime is likely to have issues like this.

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

2 participants