Skip to content

[v3] Fix Windows build error with go-webview2 v1.0.22#4645

Merged
leaanthony merged 4 commits into
v3-alphafrom
fix-4513-webview2-build-error
Oct 14, 2025
Merged

[v3] Fix Windows build error with go-webview2 v1.0.22#4645
leaanthony merged 4 commits into
v3-alphafrom
fix-4513-webview2-build-error

Conversation

@leaanthony

@leaanthony leaanthony commented Oct 13, 2025

Copy link
Copy Markdown
Member

Description

Fixes #4513

The go-webview2 library changed the MessageCallback signature in v1.0.22 from func(string) to func(message string, sender *ICoreWebView2, args *ICoreWebView2WebMessageReceivedEventArgs).

This caused a build error for users on Windows:

cannot use w.processMessage (value of type func(message string)) as 
func(message string, sender *ICoreWebView2, args *ICoreWebView2WebMessageReceivedEventArgs) 
value in assignment

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Changes Made

  • Updated processMessage method signature in webview_window_windows.go to match go-webview2 v1.0.22
  • Upgraded github.com/wailsapp/go-webview2 dependency from v1.0.21 to v1.0.22

How Has This Been Tested?

  • Code compiles for Windows target (GOOS=windows GOARCH=amd64 go build)
  • Windows runtime testing (requires Windows environment)

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a Windows build/runtime issue related to recent webview update, improving stability when handling webview messages.
  • Refactor
    • Aligned Windows webview message handling with the updated callback conventions; behavior unchanged for end users.
  • Chores
    • Upgraded the Windows webview dependency to the latest patch release for improved reliability.

Fixes #4513

The go-webview2 library changed the MessageCallback signature in v1.0.22
from `func(string)` to `func(message string, sender *ICoreWebView2, args *ICoreWebView2WebMessageReceivedEventArgs)`.

This caused a build error for users:
```
cannot use w.processMessage (value of type func(message string)) as
func(message string, sender *ICoreWebView2, args *ICoreWebView2WebMessageReceivedEventArgs)
value in assignment
```

Changes:
- Updated processMessage signature to match go-webview2 v1.0.22
- Upgraded go-webview2 dependency from v1.0.21 to v1.0.22

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 2025

Copy link
Copy Markdown

Deploying wails with  Cloudflare Pages  Cloudflare Pages

Latest commit: d8aae4c
Status:🚫  Build failed.

View logs

@coderabbitai

coderabbitai Bot commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Updates dependency github.com/wailsapp/go-webview2 to v1.0.22 and adjusts the Windows WebView message handler signature to accept sender and args, aligning the callback with the WebView2 API. Adds an UNRELEASED changelog entry documenting the Windows build fix.

Changes

Cohort / File(s) Summary of changes
Dependencies
v3/go.mod
Bumped github.com/wailsapp/go-webview2 from v1.0.21 to v1.0.22.
Windows WebView message handling
v3/pkg/application/webview_window_windows.go
Changed processMessage signature from func (w *windowsWebviewWindow) processMessage(message string) to func (w *windowsWebviewWindow) processMessage(message string, sender *edge.ICoreWebView2, args *edge.ICoreWebView2WebMessageReceivedEventArgs); internal enqueue behavior unchanged.
Changelog
v3/UNRELEASED_CHANGELOG.md
Added Windows-specific fixed entry: “Fix Windows build error caused by go-webview2 v1.0.22 signature change (#4513, #4645)”.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Edge as WebView2 (Edge)
  participant WinWin as windowsWebviewWindow
  participant Buffer as windowMessageBuffer

  Edge->>WinWin: WebMessageReceived(message, sender, args)
  note right of WinWin #cfe8ff: Callback now accepts sender and args
  WinWin->>Buffer: Enqueue(message)
  Buffer-->>WinWin: Ack
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

Bug, go, size:M

Poem

A rabbit taps keys, tidy and spry,
New args hop in—no build will cry.
Messages queue, neat as a trail,
Windows now sings a small, happy tale. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The description provides a clear summary of the change, references issue #4513, explains the root cause, lists the type of change, outlines modifications made, describes testing steps, and includes a checklist, but it omits the required Test Configuration section asking for environment details or the output of wails doctor. Please add a Test Configuration section with your environment details or the output of wails doctor so the description fully conforms to the repository template.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The title “[v3] Fix Windows build error with go-webview2 v1.0.22” clearly and concisely summarizes the primary change by identifying the bug fixed, the platform affected, and the dependency version involved, making it immediately understandable to reviewers scanning the history.
Linked Issues Check ✅ Passed The changes directly fulfill the objectives from issue #4513 by updating the processMessage signature to match the new WebView2 callback, bumping the dependency to v1.0.22, and restoring the Windows build, and the changelog entry documents the fix for users.
Out of Scope Changes Check ✅ Passed All modifications—upgrading the go-webview2 dependency, adjusting the Windows processMessage signature, and updating the changelog—are directly related to resolving the linked Windows build error and introduce no unrelated or extraneous changes.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-4513-webview2-build-error

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@VirxEC

VirxEC commented Oct 13, 2025

Copy link
Copy Markdown

Just tested this locally, looks like it works 👍

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Missing Changelog Update

Hi @leaanthony, please update v3/UNRELEASED_CHANGELOG.md with a description of your changes.

This helps us keep track of changes for the next release.

Fixes #4513

The go-webview2 library changed the MessageCallback signature in v1.0.22
from `func(string)` to `func(message string, sender *ICoreWebView2, args *ICoreWebView2WebMessageReceivedEventArgs)`.

This caused a build error for users:
```
cannot use w.processMessage (value of type func(message string)) as
func(message string, sender *ICoreWebView2, args *ICoreWebView2WebMessageReceivedEventArgs)
value in assignment
```

Changes:
- Updated processMessage signature to match go-webview2 v1.0.22
- Upgraded go-webview2 dependency from v1.0.21 to v1.0.22

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Oct 14, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
v3/UNRELEASED_CHANGELOG.md (1)

26-27: Link issue/PR references for consistency

The previous entry links directly to the PR; do the same here so readers can jump straight to the issue and PR details.

Apply this diff:

-- Fix Windows build error caused by go-webview2 v1.0.22 signature change (#4513, #4645)
+- Fix Windows build error caused by go-webview2 v1.0.22 signature change ([#4513](https://github.com/wailsapp/wails/issues/4513), [#4645](https://github.com/wailsapp/wails/pull/4645))
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a7889d and 72b8604.

📒 Files selected for processing (1)
  • v3/UNRELEASED_CHANGELOG.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Run Go Tests v3 (ubuntu-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (windows-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (macos-latest, 1.24)
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
  • GitHub Check: semgrep-cloud-platform/scan

@leaanthony leaanthony enabled auto-merge (squash) October 14, 2025 10:04
@leaanthony leaanthony disabled auto-merge October 14, 2025 10:04
@sonarqubecloud

Copy link
Copy Markdown

@leaanthony leaanthony merged commit f091eee into v3-alpha Oct 14, 2025
55 of 56 checks passed
@leaanthony leaanthony deleted the fix-4513-webview2-build-error branch October 14, 2025 10:40
@coderabbitai coderabbitai Bot mentioned this pull request Nov 24, 2025
15 tasks
Grantmartin2002 pushed a commit to Grantmartin2002/wails that referenced this pull request Apr 29, 2026
* Fix Windows build error with go-webview2 v1.0.22

Fixes wailsapp#4513

The go-webview2 library changed the MessageCallback signature in v1.0.22
from `func(string)` to `func(message string, sender *ICoreWebView2, args *ICoreWebView2WebMessageReceivedEventArgs)`.

This caused a build error for users:
```
cannot use w.processMessage (value of type func(message string)) as
func(message string, sender *ICoreWebView2, args *ICoreWebView2WebMessageReceivedEventArgs)
value in assignment
```

Changes:
- Updated processMessage signature to match go-webview2 v1.0.22
- Upgraded go-webview2 dependency from v1.0.21 to v1.0.22

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix Windows build error with go-webview2 v1.0.22

Fixes wailsapp#4513

The go-webview2 library changed the MessageCallback signature in v1.0.22
from `func(string)` to `func(message string, sender *ICoreWebView2, args *ICoreWebView2WebMessageReceivedEventArgs)`.

This caused a build error for users:
```
cannot use w.processMessage (value of type func(message string)) as
func(message string, sender *ICoreWebView2, args *ICoreWebView2WebMessageReceivedEventArgs)
value in assignment
```

Changes:
- Updated processMessage signature to match go-webview2 v1.0.22
- Upgraded go-webview2 dependency from v1.0.21 to v1.0.22

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation v3-alpha Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants