Skip to content

Conversation

nikolaymatrosov
Copy link

@nikolaymatrosov nikolaymatrosov commented Jul 13, 2025

Related issue

Fixes #3912

Description

Overview

This pull request addresses compatibility issues with Go 1.24 WebAssembly support in the CDK for Terraform (CDKTF) project. The changes focus on updating the WebAssembly bridge implementation to work with the new entrypoint mechanism introduced in Go 1.24.

Problem Statement

Go 1.24 introduced changes to the WebAssembly entrypoint mechanism that affects how Go WebAssembly modules are initialized in JavaScript environments. The current implementation in CDKTF was designed for Go 1.19+ but needed updates to properly support Go 1.24's new WebAssembly runtime behavior.

Technical Approach

  1. WebAssembly Bridge Updates
    Updated the bridge.ts files in both @cdktf/hcl-tools and @cdktf/hcl2json packages to handle the new Go 1.24 WebAssembly entrypoint
    Modified the initialization sequence to properly load and execute the WebAssembly modules with the updated runtime
  2. Build System Enhancements
    Updated the prebuild.sh scripts to ensure proper copying of the wasm_exec.js file from the Go installation
    Enhanced the build process to handle the new WebAssembly module structure
  3. Runtime Compatibility
    Ensured backward compatibility with existing Go versions while adding support for Go 1.24
    Updated the bridge JavaScript files to handle the new entrypoint mechanism
    Design Decisions

Backward Compatibility: The changes are designed to work with both older Go versions (1.19+) and the new Go 1.24, ensuring a smooth transition for users.

Minimal Impact: By focusing only on the WebAssembly entrypoint changes, the modifications have minimal impact on the rest of the codebase and maintain the existing API contracts.

Testing Strategy

  • Verified WebAssembly module loading with Go 1.24
  • Ensured HCL parsing and formatting functionality works correctly
  • Tested backward compatibility with Go 1.19+
  • Validated that the build process works across different Go versions

Checklist

  • I have updated the PR title to match CDKTF's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

Copy link
Contributor

Hi there! 👋 We haven't heard from you in 60 days and would like to know if you're still working on this or need help. If we don't hear from you before then, I'll auto-close this PR in 30 days.

@github-actions github-actions bot added the stale An issue or pull request that has not been updated in a very long time label Sep 15, 2025
@nikolaymatrosov
Copy link
Author

@mutahhir @ansgarm Could you please take a look at this PR when you have a moment? Thanks!

@github-actions github-actions bot removed the stale An issue or pull request that has not been updated in a very long time label Sep 16, 2025
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.

hcl2json: support new location of wasm_exec.js
1 participant