Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I saw that the build in another PR failed, and wanted to investigate. I could reproduce it on my laptop also when pulling latest
main
. However no other workflow fails which I'm not sure why.Error:
I'm not an expert in this :) , let me know if I got it right:
Offending code is trying to convert ptr/size pair from wasm world into a Go string.
tinygo docs says that Go's
SliceHeader
'sLen
andCap
areint
and in tinygo they areuintptr
(this is by design).But the error tells us that when it tried to assign
size
, it got it asuintptr
but it expectedint
(as if it is building with Go). Not sure how this happens becuase this code has a build constraint oftinygo.wasm
.Anyway, the same doc says we should no longer use
SliceHeader
(it's deprecated) and instead useunsafe.Slice
. I noticed there is also now anunsafe.String
which sounds even more fitting for this use case.So I changed the offending code to use it and it now compiles (and also unit tests succeed).
As a side, this error occurs twice, but it seems like with a small refactor we can reuse the code, so I added a second commit that does that.
I'm still unsure of:
tinygo version 0.34.0 darwin/arm64 (using go version go1.23.1 and LLVM version 18.1.2)
)