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

feat: replace TinyGo with standard Go for WebAssembly modules #8496

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

knqyf263
Copy link
Collaborator

@knqyf263 knqyf263 commented Mar 5, 2025

Description

Go 1.24 improved Wasm support. We can directly compile Go code into Wasm modules without TinyGo.
https://go.dev/blog/wasmexport

  • Update module documentation to reflect Go support instead of TinyGo
  • Modify build commands to use standard Go for WebAssembly compilation
  • Remove TinyGo-specific code and comments
  • Update WASM SDK to work with standard Go
  • Remove TinyGo-specific UUID implementation
  • Update build scripts and example modules to use Go build

Related PRs

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

- Update module documentation to reflect Go support instead of TinyGo
- Modify build commands to use standard Go for WebAssembly compilation
- Remove TinyGo-specific code and comments
- Update WASM SDK to work with standard Go
- Remove TinyGo-specific UUID implementation
- Update build scripts and example modules to use Go build
@knqyf263 knqyf263 self-assigned this Mar 5, 2025
knqyf263 added 2 commits March 6, 2025 10:09
- Add explicit memory management for WASM module function calls
- Implement deferred pointer freeing for dynamically allocated memory
- Add comments explaining memory allocation and freeing responsibilities
- Refactor module functions to consistently handle memory allocation
- Improve error handling and resource management in WASM module interactions
@knqyf263 knqyf263 changed the title feat(module): replace TinyGo with standard Go for WebAssembly modules feat: replace TinyGo with standard Go for WebAssembly modules Mar 6, 2025
knqyf263 added 6 commits March 6, 2025 11:34
- Move artifact type constants from `artifact` package to `fanal/types`
- Update all references to use `ftypes.ArtifactType` instead of `artifact.Type`
- Remove redundant type definition in `artifact` package
- Ensure consistent usage of artifact type across the project
- Improve type safety and reduce package dependencies
- Replace custom serialization types with standard `types.Results`
- Update module interfaces to use `types.Results` instead of `serialize.Results`
- Remove redundant type definitions in `serialize` package
- Simplify type imports and reduce package complexity
- Improve compatibility with standard Go WebAssembly modules
- Replace `serialize.CustomResource` with `ftypes.CustomResource`
- Update Spring4Shell module to use `ftypes.CustomResource`
- Remove redundant type definition in `serialize` package
- Improve type consistency across module and fanal packages
- Clean up unnecessary dependencies in go.mod and go.sum
- Remove tools and packages no longer used in the project
- Simplify dependency management by removing redundant entries
- Reduce project complexity and potential version conflicts
- Replace `serialize.Results` with `types.Results` in module test files
- Update import statements to use `types.Results`
- Maintain consistency with previous type migration efforts
- Simplify type imports for module test data
@@ -86,23 +86,10 @@ type Artifact interface {
Clean(reference Reference) error
}

// Type represents a type of artifact
type Type string
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

artifact package imports many other modules, which cannot be compiled to Wasm. I moved this type to fanal/types so Wasm modules will not import artifact.

- Ensure proper database connection closure after test
- Use `t.Cleanup()` to automatically close database connection
- Improve test resource management and prevent potential resource leaks
@knqyf263 knqyf263 marked this pull request as ready for review March 6, 2025 10:42
@knqyf263 knqyf263 requested a review from DmitriyLewen as a code owner March 6, 2025 10:42
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 this pull request may close these issues.

1 participant