-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add wit-bindgen Go packages #15
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
Conversation
Signed-off-by: Andrew Steurer <94206073+asteurer@users.noreply.github.com>
| "go.bytecodealliance.org/wit_runtime" | ||
| ) | ||
|
|
||
| const EVENT_NONE uint32 = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: constants should use iota:
const (
EVENT_NONE = iota
EVENT_SUBTASK
EVENT_STREAM_READ
// etc| <head> | ||
| <title>go.bytecodealliance.org/cmd</title> | ||
| <meta name="go-import" content="go.bytecodealliance.org git https://github.com/bytecodealliance/componentize-go" /> | ||
| <meta http-equiv="refresh" content="0; url=https://pkg.go.dev/go.bytecodealliance.org/wit_async"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does make me want to go ahead and bring over the wit package from go-modules so that we can do wit/async, wit/runtime, wit/types
| return offset | ||
| } | ||
|
|
||
| // Notify the host that the StreamReader is no longer being used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be StreamWriter
| } | ||
| pinner.Pin(buffer) | ||
|
|
||
| code, count := wit_async.FutureOrStreamWait(self.vtable.Read(handle, buffer, uint32(len(dst))), handle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this handles cancellation. Falls through to return count even for unexpected return codes. Consider adding an explicit panic or error handling for unknown codes.
| runtime.AddCleanup(value, func(_ int) { | ||
| handleValue := handle.TakeOrNil() | ||
| if handleValue != 0 { | ||
| vtable.DropReadable(handleValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be DropWritable
| runtime.AddCleanup(value, func(_ int) { | ||
| handleValue := handle.TakeOrNil() | ||
| if handleValue != 0 { | ||
| vtable.DropReadable(handleValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, seems like this should be DropWritable
No description provided.