From 4dce80d88769e28c2ca90cfa7176b72a64577261 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Mon, 5 Jan 2026 08:26:35 +1100 Subject: [PATCH] fix(v3): revert goccy/go-json to stdlib encoding/json to fix Windows panic (#4859) * fix(v3): warm up dialog types in go-json cache to prevent Windows panic Add FileFilter, OpenFileDialogOptions, SaveFileDialogOptions, and MessageDialogOptions to the init() warmup to prevent index out of bounds panic on Windows when these types are first unmarshaled. Fixes goccy/go-json#474 for Wails internal dialog types. * fix(v3): revert goccy/go-json to stdlib encoding/json to fix Windows panic goccy/go-json has a type address calculation bug on Windows that causes index out of bounds panic when decoding user-defined types for the first time. This reverts all runtime usages of goccy/go-json back to stdlib encoding/json. Test and benchmark files are left unchanged. Partially reverts PR #4843. --- v3/UNRELEASED_CHANGELOG.md | 1 + v3/go.mod | 10 --- v3/go.sum | 27 -------- .../assetserver/webview/request_darwin.go | 2 +- .../assetserver/webview/request_ios.go | 2 +- .../webview/responsewriter_darwin.go | 2 +- .../assetserver/webview/responsewriter_ios.go | 2 +- v3/internal/capabilities/capabilities.go | 2 +- v3/internal/runtime/runtime.go | 2 +- v3/pkg/application/application_android.go | 2 +- .../application/application_android_nocgo.go | 2 +- v3/pkg/application/application_darwin.go | 2 +- v3/pkg/application/application_ios.go | 2 +- v3/pkg/application/bindings.go | 64 +------------------ v3/pkg/application/events.go | 2 +- v3/pkg/application/ios_runtime_ios.go | 2 +- v3/pkg/application/json_libs_bench_test.go | 4 ++ v3/pkg/application/logger_ios.go | 2 +- v3/pkg/application/messageprocessor_args.go | 2 +- v3/pkg/application/messageprocessor_call.go | 2 +- v3/pkg/application/messageprocessor_events.go | 2 +- v3/pkg/application/single_instance.go | 2 +- v3/pkg/application/transport_http.go | 2 +- v3/pkg/application/webview_window.go | 2 +- v3/pkg/services/kvstore/kvstore.go | 2 +- .../notifications/notifications_darwin.go | 2 +- .../notifications/notifications_linux.go | 2 +- .../notifications/notifications_windows.go | 2 +- 28 files changed, 31 insertions(+), 121 deletions(-) diff --git a/v3/UNRELEASED_CHANGELOG.md b/v3/UNRELEASED_CHANGELOG.md index 2f857d519..cc6c74940 100644 --- a/v3/UNRELEASED_CHANGELOG.md +++ b/v3/UNRELEASED_CHANGELOG.md @@ -26,6 +26,7 @@ After processing, the content will be moved to the main changelog and this file - Fix SaveFileDialog.SetFilename() having no effect on Linux (#4841) by @samstanier - Fix drop coordinates showing as undefined in drag-n-drop example - Fix macOS app bundle creation failing when APP_NAME contains spaces (brace expansion issue) +- Fix index out of bounds panic on Windows when calling service methods (revert goccy/go-json) ## Deprecated diff --git a/v3/go.mod b/v3/go.mod index 407db2905..b5fe8b282 100644 --- a/v3/go.mod +++ b/v3/go.mod @@ -8,14 +8,12 @@ require ( github.com/adrg/xdg v0.5.3 github.com/atterpac/refresh v0.8.6 github.com/bep/debounce v1.2.1 - github.com/bytedance/sonic v1.14.2 github.com/charmbracelet/glamour v0.9.0 github.com/charmbracelet/huh v0.8.0 github.com/ebitengine/purego v0.8.2 github.com/go-git/go-git/v5 v5.13.2 github.com/go-json-experiment/json v0.0.0-20251027170946-4849db3c2f7e github.com/go-ole/go-ole v1.3.0 - github.com/goccy/go-json v0.10.5 github.com/godbus/dbus/v5 v5.1.0 github.com/google/go-cmp v0.7.0 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 @@ -24,7 +22,6 @@ require ( github.com/gorilla/websocket v1.5.3 github.com/jackmordaunt/icns/v2 v2.2.7 github.com/jaypipes/ghw v0.17.0 - github.com/json-iterator/go v1.1.12 github.com/konoui/lipo v0.10.0 github.com/leaanthony/clir v1.7.0 github.com/leaanthony/go-ansi-parser v1.6.1 @@ -55,8 +52,6 @@ require ( al.essio.dev/pkg/shellescape v1.5.1 // indirect atomicgo.dev/schedule v0.1.0 // indirect github.com/atotto/clipboard v0.1.4 // indirect - github.com/bytedance/gopkg v0.1.3 // indirect - github.com/bytedance/sonic/loader v0.4.0 // indirect github.com/catppuccin/go v0.3.0 // indirect github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 // indirect github.com/charmbracelet/bubbletea v1.3.6 // indirect @@ -64,18 +59,13 @@ require ( github.com/charmbracelet/x/cellbuf v0.0.13 // indirect github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect github.com/charmbracelet/x/term v0.2.1 // indirect - github.com/cloudwego/base64x v0.1.6 // indirect github.com/danieljoos/wincred v1.2.2 // indirect github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/konoui/go-qsort v0.1.0 // indirect github.com/mattn/go-localereader v0.0.1 // indirect - github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect ) require ( diff --git a/v3/go.sum b/v3/go.sum index 899e70059..f5bde5f7c 100644 --- a/v3/go.sum +++ b/v3/go.sum @@ -77,12 +77,6 @@ github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY= github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0= github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb h1:m935MPodAbYS46DG4pJSv7WO+VECIWUQ7OJYSoTrMh4= github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI= -github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M= -github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= -github.com/bytedance/sonic v1.14.2 h1:k1twIoe97C1DtYUo+fZQy865IuHia4PR5RPiuGPPIIE= -github.com/bytedance/sonic v1.14.2/go.mod h1:T80iDELeHiHKSc0C9tubFygiuXoGzrkjKzX2quAx980= -github.com/bytedance/sonic/loader v0.4.0 h1:olZ7lEqcxtZygCK9EKYKADnpQoYkRQxaeY2NYzevs+o= -github.com/bytedance/sonic/loader v0.4.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo= github.com/caarlos0/testfs v0.4.4 h1:3PHvzHi5Lt+g332CiShwS8ogTgS3HjrmzZxCm6JCDr8= github.com/caarlos0/testfs v0.4.4/go.mod h1:bRN55zgG4XCUVVHZCeU+/Tz1Q6AxEJOEJTliBy+1DMk= github.com/catppuccin/go v0.3.0 h1:d+0/YicIq+hSTo5oPuRi5kOpqkVA5tAsU6dNhvRu+aY= @@ -123,8 +117,6 @@ github.com/charmbracelet/x/xpty v0.1.2 h1:Pqmu4TEJ8KeA9uSkISKMU3f+C1F6OGBn8ABuGl github.com/charmbracelet/x/xpty v0.1.2/go.mod h1:XK2Z0id5rtLWcpeNiMYBccNNBrP2IJnzHI0Lq13Xzq4= github.com/cloudflare/circl v1.6.0 h1:cr5JKic4HI+LkINy2lg3W2jF8sHCVTBncJr5gIIq7qk= github.com/cloudflare/circl v1.6.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= -github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= -github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= @@ -178,15 +170,12 @@ github.com/go-task/template v0.1.0 h1:ym/r2G937RZA1bsgiWedNnY9e5kxDT+3YcoAnuIetT github.com/go-task/template v0.1.0/go.mod h1:RgwRaZK+kni/hJJ7/AaOE2lPQFPbAdji/DyhC6pxo4k= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= -github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo= github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a h1:JJBdjSfqSy3mnDT0940ASQFghwcZ4y4cb6ttjAoXqwE= @@ -228,8 +217,6 @@ github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEE github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= @@ -298,10 +285,6 @@ github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4 github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= @@ -368,24 +351,16 @@ github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cA github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tc-hib/winres v0.3.1 h1:CwRjEGrKdbi5CvZ4ID+iyVhgyfatxFoizjPhzez9Io4= github.com/tc-hib/winres v0.3.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk= -github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= -github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/wailsapp/go-webview2 v1.0.22 h1:YT61F5lj+GGaat5OB96Aa3b4QA+mybD0Ggq6NZijQ58= @@ -413,8 +388,6 @@ github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= gitlab.com/digitalxero/go-conventional-commit v1.0.7 h1:8/dO6WWG+98PMhlZowt/YjuiKhqhGlOCwlIV8SqqGh8= gitlab.com/digitalxero/go-conventional-commit v1.0.7/go.mod h1:05Xc2BFsSyC5tKhK0y+P3bs0AwUtNuTp+mTpbCU/DZ0= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= diff --git a/v3/internal/assetserver/webview/request_darwin.go b/v3/internal/assetserver/webview/request_darwin.go index 2b961d781..dd2d0232a 100644 --- a/v3/internal/assetserver/webview/request_darwin.go +++ b/v3/internal/assetserver/webview/request_darwin.go @@ -115,7 +115,7 @@ import ( "net/http" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" ) // NewRequest creates as new WebViewRequest based on a pointer to an `id` diff --git a/v3/internal/assetserver/webview/request_ios.go b/v3/internal/assetserver/webview/request_ios.go index 1a1941c7e..81d23b0bc 100644 --- a/v3/internal/assetserver/webview/request_ios.go +++ b/v3/internal/assetserver/webview/request_ios.go @@ -113,7 +113,7 @@ import ( "net/http" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" ) // NewRequest creates as new WebViewRequest based on a pointer to an `id` diff --git a/v3/internal/assetserver/webview/responsewriter_darwin.go b/v3/internal/assetserver/webview/responsewriter_darwin.go index 4bac699d6..ff29a08bb 100644 --- a/v3/internal/assetserver/webview/responsewriter_darwin.go +++ b/v3/internal/assetserver/webview/responsewriter_darwin.go @@ -71,7 +71,7 @@ import ( "net/http" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" ) var _ ResponseWriter = &responseWriter{} diff --git a/v3/internal/assetserver/webview/responsewriter_ios.go b/v3/internal/assetserver/webview/responsewriter_ios.go index a6284b804..119ef1628 100644 --- a/v3/internal/assetserver/webview/responsewriter_ios.go +++ b/v3/internal/assetserver/webview/responsewriter_ios.go @@ -73,7 +73,7 @@ import ( "strings" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" ) var _ ResponseWriter = &responseWriter{} diff --git a/v3/internal/capabilities/capabilities.go b/v3/internal/capabilities/capabilities.go index 1af25e91a..af9428bb2 100644 --- a/v3/internal/capabilities/capabilities.go +++ b/v3/internal/capabilities/capabilities.go @@ -1,6 +1,6 @@ package capabilities -import json "github.com/goccy/go-json" +import "encoding/json" type Capabilities struct { HasNativeDrag bool diff --git a/v3/internal/runtime/runtime.go b/v3/internal/runtime/runtime.go index 42fed010d..d35ff0552 100644 --- a/v3/internal/runtime/runtime.go +++ b/v3/internal/runtime/runtime.go @@ -3,7 +3,7 @@ package runtime import ( "fmt" - json "github.com/goccy/go-json" + "encoding/json" ) var runtimeInit = `window._wails=window._wails||{};window._wails.flags=window._wails.flags||{};window.wails=window.wails||{};` diff --git a/v3/pkg/application/application_android.go b/v3/pkg/application/application_android.go index e5da744eb..87bb1b2f4 100644 --- a/v3/pkg/application/application_android.go +++ b/v3/pkg/application/application_android.go @@ -148,7 +148,7 @@ import ( "time" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" "github.com/wailsapp/wails/v3/internal/runtime" ) diff --git a/v3/pkg/application/application_android_nocgo.go b/v3/pkg/application/application_android_nocgo.go index cb31203dd..ea769f3e1 100644 --- a/v3/pkg/application/application_android_nocgo.go +++ b/v3/pkg/application/application_android_nocgo.go @@ -7,7 +7,7 @@ import ( "sync" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" ) var ( diff --git a/v3/pkg/application/application_darwin.go b/v3/pkg/application/application_darwin.go index e6e0b080a..f5738f93f 100644 --- a/v3/pkg/application/application_darwin.go +++ b/v3/pkg/application/application_darwin.go @@ -200,7 +200,7 @@ import ( "time" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" "github.com/wailsapp/wails/v3/internal/assetserver/webview" "github.com/wailsapp/wails/v3/internal/operatingsystem" diff --git a/v3/pkg/application/application_ios.go b/v3/pkg/application/application_ios.go index 7b0da7eee..90e896b07 100644 --- a/v3/pkg/application/application_ios.go +++ b/v3/pkg/application/application_ios.go @@ -20,7 +20,7 @@ import ( "time" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" "github.com/wailsapp/wails/v3/internal/assetserver/webview" "github.com/wailsapp/wails/v3/pkg/events" diff --git a/v3/pkg/application/bindings.go b/v3/pkg/application/bindings.go index 42830d07e..e16948399 100644 --- a/v3/pkg/application/bindings.go +++ b/v3/pkg/application/bindings.go @@ -2,75 +2,17 @@ package application import ( "context" + "encoding/json" "errors" "fmt" "reflect" "runtime" "strings" - json "github.com/goccy/go-json" - "github.com/wailsapp/wails/v3/internal/hash" "github.com/wailsapp/wails/v3/internal/sliceutil" ) -// init forces goccy/go-json to initialize its type address cache at program startup. -// This prevents a Windows-specific index out-of-bounds panic that can occur when the decoder is first invoked later (see https://github.com/goccy/go-json/issues/474). -func init() { - // Force goccy/go-json to initialize its type address cache early. - // On Windows, if the decoder is first invoked later (e.g., during tests), - // the type address calculation can fail with an index out of bounds panic. - // See: https://github.com/goccy/go-json/issues/474 - var ( - s string - i int - i8 int8 - i16 int16 - i32 int32 - i64 int64 - u uint - u8 uint8 - u16 uint16 - u32 uint32 - u64 uint64 - f32 float32 - f64 float64 - b bool - bs []byte - ss []string - si []int - sf []float64 - sa []any - msa map[string]any - mss map[string]string - msi map[string]int - rm json.RawMessage - ) - _ = json.Unmarshal([]byte(`""`), &s) - _ = json.Unmarshal([]byte(`0`), &i) - _ = json.Unmarshal([]byte(`0`), &i8) - _ = json.Unmarshal([]byte(`0`), &i16) - _ = json.Unmarshal([]byte(`0`), &i32) - _ = json.Unmarshal([]byte(`0`), &i64) - _ = json.Unmarshal([]byte(`0`), &u) - _ = json.Unmarshal([]byte(`0`), &u8) - _ = json.Unmarshal([]byte(`0`), &u16) - _ = json.Unmarshal([]byte(`0`), &u32) - _ = json.Unmarshal([]byte(`0`), &u64) - _ = json.Unmarshal([]byte(`0`), &f32) - _ = json.Unmarshal([]byte(`0`), &f64) - _ = json.Unmarshal([]byte(`false`), &b) - _ = json.Unmarshal([]byte(`""`), &bs) - _ = json.Unmarshal([]byte(`[]`), &ss) - _ = json.Unmarshal([]byte(`[]`), &si) - _ = json.Unmarshal([]byte(`[]`), &sf) - _ = json.Unmarshal([]byte(`[]`), &sa) - _ = json.Unmarshal([]byte(`{}`), &msa) - _ = json.Unmarshal([]byte(`{}`), &mss) - _ = json.Unmarshal([]byte(`{}`), &msi) - _ = json.Unmarshal([]byte(`""`), &rm) -} - // CallOptions defines the options for a method call. // Field order is optimized to minimize struct padding. type CallOptions struct { @@ -228,7 +170,7 @@ var internalServiceMethods = map[string]bool{ var ctxType = reflect.TypeFor[context.Context]() // getMethods returns the list of BoundMethod descriptors for the methods of the named pointer type provided by value. -// +// // It returns an error if value is not a pointer to a named type, if a function value is supplied (binding functions is deprecated), or if a generic type is supplied. // The returned BoundMethod slice includes only exported methods that are not listed in internalServiceMethods. Each BoundMethod has its FQN, ID (computed from the FQN), Method reflect.Value, Inputs and Outputs populated, isVariadic cached from the method signature, and needsContext set when the first parameter is context.Context. func getMethods(value any) ([]*BoundMethod, error) { @@ -482,4 +424,4 @@ func isNamed(value interface{}) bool { } return rv.Type().Name() != "" -} \ No newline at end of file +} diff --git a/v3/pkg/application/events.go b/v3/pkg/application/events.go index f70d37123..dbe6d20a2 100644 --- a/v3/pkg/application/events.go +++ b/v3/pkg/application/events.go @@ -7,7 +7,7 @@ import ( "sync" "sync/atomic" - json "github.com/goccy/go-json" + "encoding/json" "github.com/wailsapp/wails/v3/pkg/events" ) diff --git a/v3/pkg/application/ios_runtime_ios.go b/v3/pkg/application/ios_runtime_ios.go index 0b4b5b35b..6a388d9a9 100644 --- a/v3/pkg/application/ios_runtime_ios.go +++ b/v3/pkg/application/ios_runtime_ios.go @@ -12,7 +12,7 @@ import "C" import ( "unsafe" - json "github.com/goccy/go-json" + "encoding/json" ) // iosHapticsImpact triggers an iOS haptic impact using the provided style. diff --git a/v3/pkg/application/json_libs_bench_test.go b/v3/pkg/application/json_libs_bench_test.go index 274b29b5f..c3e7e4918 100644 --- a/v3/pkg/application/json_libs_bench_test.go +++ b/v3/pkg/application/json_libs_bench_test.go @@ -1,7 +1,10 @@ //go:build bench +// Disabled: goccy/go-json causes Windows panics. See PR #4859. + package application_test +/* import ( "encoding/json" "testing" @@ -308,3 +311,4 @@ func BenchmarkMarshal_Complex_Sonic(b *testing.B) { _, _ = sonic.Marshal(complexResult) } } +*/ diff --git a/v3/pkg/application/logger_ios.go b/v3/pkg/application/logger_ios.go index ed77d09b5..584e96609 100644 --- a/v3/pkg/application/logger_ios.go +++ b/v3/pkg/application/logger_ios.go @@ -17,7 +17,7 @@ import ( "time" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" ) // iosConsoleHandler implements slog.Handler and forwards records to the WKWebView console. diff --git a/v3/pkg/application/messageprocessor_args.go b/v3/pkg/application/messageprocessor_args.go index 3eeb98701..bb3ffc6d0 100644 --- a/v3/pkg/application/messageprocessor_args.go +++ b/v3/pkg/application/messageprocessor_args.go @@ -3,7 +3,7 @@ package application import ( "fmt" - json "github.com/goccy/go-json" + "encoding/json" ) type Args struct { diff --git a/v3/pkg/application/messageprocessor_call.go b/v3/pkg/application/messageprocessor_call.go index 9b58801da..924acdbf0 100644 --- a/v3/pkg/application/messageprocessor_call.go +++ b/v3/pkg/application/messageprocessor_call.go @@ -4,7 +4,7 @@ import ( "context" "errors" - json "github.com/goccy/go-json" + "encoding/json" "github.com/wailsapp/wails/v3/pkg/errs" ) diff --git a/v3/pkg/application/messageprocessor_events.go b/v3/pkg/application/messageprocessor_events.go index d251c6ace..9de3ae136 100644 --- a/v3/pkg/application/messageprocessor_events.go +++ b/v3/pkg/application/messageprocessor_events.go @@ -1,7 +1,7 @@ package application import ( - json "github.com/goccy/go-json" + "encoding/json" "github.com/wailsapp/wails/v3/pkg/errs" ) diff --git a/v3/pkg/application/single_instance.go b/v3/pkg/application/single_instance.go index 681998874..7f04320eb 100644 --- a/v3/pkg/application/single_instance.go +++ b/v3/pkg/application/single_instance.go @@ -10,7 +10,7 @@ import ( "path/filepath" "sync" - json "github.com/goccy/go-json" + "encoding/json" ) var alreadyRunningError = errors.New("application is already running") diff --git a/v3/pkg/application/transport_http.go b/v3/pkg/application/transport_http.go index d043c9b53..0c2b0fd45 100644 --- a/v3/pkg/application/transport_http.go +++ b/v3/pkg/application/transport_http.go @@ -10,7 +10,7 @@ import ( "strconv" "sync" - json "github.com/goccy/go-json" + "encoding/json" "github.com/wailsapp/wails/v3/pkg/errs" ) diff --git a/v3/pkg/application/webview_window.go b/v3/pkg/application/webview_window.go index 08d21ebb3..dbf7eebcc 100644 --- a/v3/pkg/application/webview_window.go +++ b/v3/pkg/application/webview_window.go @@ -9,7 +9,7 @@ import ( "sync/atomic" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" "github.com/leaanthony/u" "github.com/wailsapp/wails/v3/internal/assetserver" diff --git a/v3/pkg/services/kvstore/kvstore.go b/v3/pkg/services/kvstore/kvstore.go index 94ce6c61f..4d2f511b0 100644 --- a/v3/pkg/services/kvstore/kvstore.go +++ b/v3/pkg/services/kvstore/kvstore.go @@ -5,7 +5,7 @@ import ( "os" "sync" - json "github.com/goccy/go-json" + "encoding/json" "github.com/pkg/errors" "github.com/wailsapp/wails/v3/pkg/application" ) diff --git a/v3/pkg/services/notifications/notifications_darwin.go b/v3/pkg/services/notifications/notifications_darwin.go index 70a505fc9..b9695b3f9 100644 --- a/v3/pkg/services/notifications/notifications_darwin.go +++ b/v3/pkg/services/notifications/notifications_darwin.go @@ -20,7 +20,7 @@ import ( "time" "unsafe" - json "github.com/goccy/go-json" + "encoding/json" "github.com/wailsapp/wails/v3/pkg/application" ) diff --git a/v3/pkg/services/notifications/notifications_linux.go b/v3/pkg/services/notifications/notifications_linux.go index 455f96cdb..23e21433e 100644 --- a/v3/pkg/services/notifications/notifications_linux.go +++ b/v3/pkg/services/notifications/notifications_linux.go @@ -9,7 +9,7 @@ import ( "path/filepath" "sync" - json "github.com/goccy/go-json" + "encoding/json" "github.com/godbus/dbus/v5" "github.com/wailsapp/wails/v3/pkg/application" diff --git a/v3/pkg/services/notifications/notifications_windows.go b/v3/pkg/services/notifications/notifications_windows.go index 6bca1e747..b1063dbf8 100644 --- a/v3/pkg/services/notifications/notifications_windows.go +++ b/v3/pkg/services/notifications/notifications_windows.go @@ -11,7 +11,7 @@ import ( "sync" _ "unsafe" - json "github.com/goccy/go-json" + "encoding/json" "git.sr.ht/~jackmordaunt/go-toast/v2" wintoast "git.sr.ht/~jackmordaunt/go-toast/v2/wintoast"