5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 21:10:54 +08:00

Misc lint fixes

This commit is contained in:
Lea Anthony 2021-01-03 21:31:19 +11:00
parent e9a0e45d5c
commit 5d41aad539
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
6 changed files with 18 additions and 13 deletions

View File

@ -25,7 +25,7 @@ func (b *Bindings) Add(structPtr interface{}) error {
methods, err := getMethods(structPtr)
if err != nil {
return fmt.Errorf("cannout bind value to app: %s", err.Error())
return fmt.Errorf("cannot bind value to app: %s", err.Error())
}
for _, method := range methods {

View File

@ -4,7 +4,7 @@ import (
"os"
)
// DefaultLogger is a utlility to log messages to a number of destinations
// DefaultLogger is a utility to log messages to a number of destinations
type DefaultLogger struct{}
// NewDefaultLogger creates a new Logger.

View File

@ -23,6 +23,12 @@ type MenuItem struct {
// Submenu contains a list of menu items that will be shown as a submenu
SubMenu []*MenuItem `json:"SubMenu,omitempty"`
// Foreground colour in hex RGBA format EG: 0xFF0000FF = #FF0000FF = red
Foreground int
// Background colour
Background int
// This holds the menu item's parent.
parent *MenuItem
}

View File

@ -17,7 +17,6 @@ var Default = &App{
Appearance: mac.DefaultAppearance,
WebviewIsTransparent: false,
WindowBackgroundIsTranslucent: false,
//Menu: menu.DefaultMacMenu(),
},
Logger: logger.NewDefaultLogger(),
LogLevel: logger.INFO,

View File

@ -39,14 +39,6 @@ func MergeDefaults(appoptions *App) {
log.Fatal(err)
}
// We need to ensure there's a default menu on Mac
switch runtime.GOOS {
case "darwin":
if GetApplicationMenu(appoptions) == nil {
appoptions.Menu = menu.NewMenuFromItems(menu.AppMenu())
}
}
}
func GetTray(appoptions *App) *menu.TrayOptions {

View File

@ -4,6 +4,7 @@ import (
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"log"
)
type Echo struct {
@ -16,7 +17,7 @@ func (e *Echo) Echo(message string) string {
func main() {
// Create application with options
app := wails.CreateAppWithOptions(&options.App{
app, err := wails.CreateAppWithOptions(&options.App{
Title: "Runtime Tester!",
Width: 850,
Height: 620,
@ -33,6 +34,10 @@ func main() {
},
})
if err != nil {
log.Fatal(err)
}
// You can also use the simplified call:
// app := wails.CreateApp("Tester!", 1024, 768)
@ -50,5 +55,8 @@ func main() {
app.Bind(&Echo{})
app.Bind(&RuntimeTest{})
app.Run()
err = app.Run()
if err != nil {
log.Fatal(err)
}
}