diff --git a/v3/internal/commands/syso.go b/v3/internal/commands/syso.go index d892d59f4..5bab7b6dc 100644 --- a/v3/internal/commands/syso.go +++ b/v3/internal/commands/syso.go @@ -2,6 +2,7 @@ package commands import ( "fmt" + "github.com/pkg/errors" "os" "runtime" @@ -42,7 +43,10 @@ func GenerateSyso(options *SysoOptions) (err error) { return err } defer func() { - err = iconFile.Close() + err2 := iconFile.Close() + if err == nil { + err = errors.Wrap(err, "error closing icon file: "+err2.Error()) + } }() ico, err := winres.LoadICO(iconFile) if err != nil { diff --git a/v3/internal/commands/syso_test.go b/v3/internal/commands/syso_test.go index 6726b548e..a7f94c553 100644 --- a/v3/internal/commands/syso_test.go +++ b/v3/internal/commands/syso_test.go @@ -125,14 +125,10 @@ func TestGenerateSyso(t *testing.T) { t.Run(tt.name, func(t *testing.T) { options := tt.setup() err := GenerateSyso(options) - if (err != nil) != tt.wantErr { + if (err == nil) && tt.wantErr { t.Errorf("GenerateSyso() error = %v, wantErr %v", err, tt.wantErr) return } - if (err != nil) && tt.wantErr { - println(err.Error()) - return - } if tt.test != nil { if err := tt.test(); err != nil { t.Errorf("GenerateSyso() test error = %v", err) diff --git a/v3/pkg/application/application_darwin.go b/v3/pkg/application/application_darwin.go index 7587ff454..335a69d2f 100644 --- a/v3/pkg/application/application_darwin.go +++ b/v3/pkg/application/application_darwin.go @@ -348,7 +348,7 @@ func cleanup() { func (a *App) logPlatformInfo() { info, err := operatingsystem.Info() if err != nil { - a.error("Error getting OS info", "error", err.Error()) + a.error("Error getting OS info: %s", err.Error()) return } @@ -360,7 +360,6 @@ func (a *App) platformEnvironment() map[string]any { return map[string]any{} } - func fatalHandler(errFunc func(error)) { - return + return } diff --git a/v3/pkg/application/keys.go b/v3/pkg/application/keys.go index fce7c94ce..375b76289 100644 --- a/v3/pkg/application/keys.go +++ b/v3/pkg/application/keys.go @@ -199,7 +199,7 @@ func parseAccelerator(shortcut string) (*accelerator, error) { if !validKey { return nil, fmt.Errorf("'%s' is not a valid key", component) } - result.Key = processedKey + result.Key = strings.ToLower(processedKey) continue } diff --git a/v3/pkg/application/menuitem_test.go b/v3/pkg/application/menuitem_test.go index bb325fcfa..b2178876f 100644 --- a/v3/pkg/application/menuitem_test.go +++ b/v3/pkg/application/menuitem_test.go @@ -14,8 +14,8 @@ func TestMenuItem_GetAccelerator(t *testing.T) { }{ { name: "Get existing accelerator", - menuItem: application.NewMenuItem("Item 1").SetAccelerator("Ctrl+A"), - expectedAcc: "ctrl+a", + menuItem: application.NewMenuItem("Item 1").SetAccelerator("ctrl+a"), + expectedAcc: "Ctrl+A", }, { name: "Get non-existing accelerator", diff --git a/v3/pkg/application/systemtray_darwin.go b/v3/pkg/application/systemtray_darwin.go index 76997d92a..1332aaf7d 100644 --- a/v3/pkg/application/systemtray_darwin.go +++ b/v3/pkg/application/systemtray_darwin.go @@ -53,7 +53,7 @@ func systrayClickCallback(id C.long, buttonID C.int) { // Get the system tray systemTray := systemTrayMap[uint(id)] if systemTray == nil { - globalApplication.error("system tray not found", "id", id) + globalApplication.error("system tray not found: %v", id) return } systemTray.processClick(button(buttonID)) diff --git a/v3/plugins/experimental/oauth/go.mod b/v3/plugins/experimental/oauth/go.mod index d70366257..5b9175750 100644 --- a/v3/plugins/experimental/oauth/go.mod +++ b/v3/plugins/experimental/oauth/go.mod @@ -58,4 +58,4 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect ) -replace github.com/wailsapp/wails/v3 => ../.. +replace github.com/wailsapp/wails/v3 => ../../..