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:
parent
e9a0e45d5c
commit
5d41aad539
@ -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 {
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ var Default = &App{
|
||||
Appearance: mac.DefaultAppearance,
|
||||
WebviewIsTransparent: false,
|
||||
WindowBackgroundIsTranslucent: false,
|
||||
//Menu: menu.DefaultMacMenu(),
|
||||
},
|
||||
Logger: logger.NewDefaultLogger(),
|
||||
LogLevel: logger.INFO,
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user