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

refactor(module): re-define serialization structs to avoid TinyGo build failures #6654

Closed
knqyf263 opened this issue May 8, 2024 · 0 comments · Fixed by #6655
Closed

refactor(module): re-define serialization structs to avoid TinyGo build failures #6654

knqyf263 opened this issue May 8, 2024 · 0 comments · Fixed by #6655
Assignees

Comments

@knqyf263
Copy link
Collaborator

knqyf263 commented May 8, 2024

Background

Currently, the structs used for serialization in the Module feature are defined under pkg/module/serialize. These structs are compiled with TinyGo for use in Wasm. However, this package imports the pkg/types package, which often causes TinyGo builds to fail. This is primarily because the type package imports third-party modules that use packages not supported by TinyGo. For example, simply refactoring the types package can suddenly cause TinyGo builds to fail. In the above case, the failure was caused by this issue, but similar problems have occurred multiple times in the past.

Proposal

Ideally, the same structs should be used on both the host and Wasm sides. Otherwise, using different structs for marshaling and unmarshaling can lead to potential failures. However, since the Module feature is still experimental and it is not desirable to spend significant time dealing with TinyGo errors, I propose redefining the structs used on the Wasm side in pkg/module/serialize and removing the import of Trivy's types package. This way, changes to the types package will not affect the Wasm side.

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

Successfully merging a pull request may close this issue.

1 participant