5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 22:13:36 +08:00

Lint fix & tidy up

This commit is contained in:
Lea Anthony 2020-12-06 21:15:23 +11:00
parent 11bf564b73
commit 6fa2ebdd4f
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
39 changed files with 67 additions and 55 deletions

View File

@ -91,7 +91,7 @@ func (a *App) Run() error {
// Start the service bus // Start the service bus
a.servicebus.Debug() a.servicebus.Debug()
err = a.servicebus.Start() err = a.servicebus.Start()
if err == nil { if err != nil {
return err return err
} }
@ -103,7 +103,7 @@ func (a *App) Run() error {
} }
a.runtime = runtimesubsystem a.runtime = runtimesubsystem
err = a.runtime.Start() err = a.runtime.Start()
if err == nil { if err != nil {
return err return err
} }
@ -119,7 +119,7 @@ func (a *App) Run() error {
} }
a.binding = bindingsubsystem a.binding = bindingsubsystem
err = a.binding.Start() err = a.binding.Start()
if err == nil { if err != nil {
return err return err
} }
@ -130,7 +130,7 @@ func (a *App) Run() error {
} }
a.log = log a.log = log
err = a.log.Start() err = a.log.Start()
if err == nil { if err != nil {
return err return err
} }
@ -141,7 +141,7 @@ func (a *App) Run() error {
} }
a.dispatcher = dispatcher a.dispatcher = dispatcher
err = dispatcher.Start() err = dispatcher.Start()
if err == nil { if err != nil {
return err return err
} }
@ -152,7 +152,7 @@ func (a *App) Run() error {
} }
a.event = event a.event = event
err = a.event.Start() err = a.event.Start()
if err == nil { if err != nil {
return err return err
} }
@ -180,7 +180,7 @@ func (a *App) Run() error {
} }
a.menu = menusubsystem a.menu = menusubsystem
err = a.menu.Start() err = a.menu.Start()
if err == nil { if err != nil {
return err return err
} }
} }
@ -194,7 +194,7 @@ func (a *App) Run() error {
} }
a.tray = traysubsystem a.tray = traysubsystem
err = a.tray.Start() err = a.tray.Start()
if err == nil { if err != nil {
return err return err
} }
} }
@ -206,7 +206,7 @@ func (a *App) Run() error {
} }
a.call = call a.call = call
err = a.call.Start() err = a.call.Start()
if err == nil { if err != nil {
return err return err
} }
@ -219,7 +219,7 @@ func (a *App) Run() error {
result := a.window.Run(dispatcher, bindingDump, a.debug) result := a.window.Run(dispatcher, bindingDump, a.debug)
a.logger.Trace("Ffenestri.Run() exited") a.logger.Trace("Ffenestri.Run() exited")
err = a.servicebus.Stop() err = a.servicebus.Stop()
if err == nil { if err != nil {
return err return err
} }

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Basic application struct // Basic application struct

View File

@ -1,15 +1,22 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"log"
) )
func main() { func main() {
// Create application with options // Create application with options
app := wails.CreateApp("{{.ProjectName}}", 1024, 768) app, err := wails.CreateApp("{{.ProjectName}}", 1024, 768)
if err != nil {
log.Fatal(err)
}
app.Bind(newBasic()) app.Bind(newBasic())
app.Run() err = app.Run()
if err != nil {
log.Fatal(err)
}
} }

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Basic application struct // Basic application struct

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
func main() { func main() {

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Basic application struct // Basic application struct

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
func main() { func main() {

View File

@ -56,11 +56,11 @@ func (s *ServerBuilder) BuildBaseAssets(assets *html.AssetBundle) error {
// Fetch, update, and reinject index.html // Fetch, update, and reinject index.html
index, err := db.Read("index.html") index, err := db.Read("index.html")
if err != nil { if err != nil {
return fmt.Errorf(`Failed to locate "index.html"`) return fmt.Errorf(`failed to locate "index.html"`)
} }
splits := strings.Split(string(index), "</body>") splits := strings.Split(string(index), "</body>")
if len(splits) != 2 { if len(splits) != 2 {
return fmt.Errorf("Unable to locate a </body> tag in your frontend/index.html") return fmt.Errorf("unable to locate a </body> tag in your frontend/index.html")
} }
injectScript := `<script defer src="/wails.js"></script><script defer src="/bindings.js"></script>` injectScript := `<script defer src="/wails.js"></script><script defer src="/bindings.js"></script>`
result := []string{} result := []string{}

View File

@ -5,7 +5,7 @@ import (
"testproject/mypackage" "testproject/mypackage"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Basic application struct // Basic application struct
@ -56,11 +56,11 @@ func (b *Basic) Greet(name string) string {
} }
// MultipleGreets returns greetings for the given name // MultipleGreets returns greetings for the given name
func (b *Basic) MultipleGreets(name string) []string { func (b *Basic) MultipleGreets(_ string) []string {
return []string{"hi", "hello", "croeso!"} return []string{"hi", "hello", "croeso!"}
} }
// RemovePerson Removes the given person // RemovePerson Removes the given person
func (b *Basic) RemovePerson(p *mypackage.Person) { func (b *Basic) RemovePerson(_ *mypackage.Person) {
// dummy // dummy
} }

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Basic application struct // Basic application struct

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
) )

View File

@ -1,9 +1,10 @@
package main package main
//goland:noinspection GoRedundantImportAlias
import ( import (
"fmt" "fmt"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Basic application struct // Basic application struct

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/mac" "github.com/wailsapp/wails/v2/pkg/options/mac"
) )

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"time" "time"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Basic application struct // Basic application struct

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
) )

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Browser struct // Browser struct

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
) )

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Events struct // Events struct

View File

@ -3,7 +3,7 @@ package main
import ( import (
"io/ioutil" "io/ioutil"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
) )

View File

@ -3,7 +3,7 @@ package main
import ( import (
"io/ioutil" "io/ioutil"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
) )

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
type MyStruct struct { type MyStruct struct {

View File

@ -4,7 +4,7 @@ import (
"image" "image"
"os" "os"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/internal/runtime" "github.com/wailsapp/wails/v2/internal/runtime"
) )

View File

@ -1,6 +1,6 @@
package main package main
import wails "github.com/wailsapp/wails/v2" import "github.com/wailsapp/wails/v2"
type MyStruct struct { type MyStruct struct {
runtime *wails.Runtime runtime *wails.Runtime

View File

@ -3,7 +3,7 @@ package main
import ( import (
"io/ioutil" "io/ioutil"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
type MyStruct struct { type MyStruct struct {

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
type MyStruct struct { type MyStruct struct {

View File

@ -1,6 +1,6 @@
package main package main
import wails "github.com/wailsapp/wails/v2" import "github.com/wailsapp/wails/v2"
type MyStruct struct { type MyStruct struct {
runtime *wails.Runtime runtime *wails.Runtime

View File

@ -1,6 +1,6 @@
package main package main
import wails "github.com/wailsapp/wails/v2" import "github.com/wailsapp/wails/v2"
type MyStruct struct { type MyStruct struct {
runtime *wails.Runtime runtime *wails.Runtime

View File

@ -1,6 +1,6 @@
package main package main
import wails "github.com/wailsapp/wails/v2" import "github.com/wailsapp/wails/v2"
type MyStruct struct { type MyStruct struct {
runtime *wails.Runtime runtime *wails.Runtime

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger" "github.com/wailsapp/wails/v2/pkg/logger"
) )

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger" "github.com/wailsapp/wails/v2/pkg/logger"
) )

View File

@ -11,7 +11,7 @@ import (
func main() { func main() {
// Create application with options // Create application with options
app := wails.CreateAppWithOptions(&options.App{ app, err := wails.CreateAppWithOptions(&options.App{
Title: "Kitchen Sink", Title: "Kitchen Sink",
Width: 1024, Width: 1024,
Height: 768, Height: 768,
@ -28,6 +28,10 @@ func main() {
LogLevel: logger.TRACE, LogLevel: logger.TRACE,
}) })
if err != nil {
log.Fatal(err)
}
app.Bind(&Events{}) app.Bind(&Events{})
app.Bind(&Logger{}) app.Bind(&Logger{})
app.Bind(&Browser{}) app.Bind(&Browser{})
@ -36,7 +40,7 @@ func main() {
app.Bind(&Window{}) app.Bind(&Window{})
app.Bind(&Menu{}) app.Bind(&Menu{})
err := app.Run() err = app.Run()
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// System struct // System struct

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Window struct // Window struct

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Basic application struct // Basic application struct

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
) )

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
) )
// Calc is a calculator // Calc is a calculator

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/mac" "github.com/wailsapp/wails/v2/pkg/options/mac"
) )

View File

@ -3,7 +3,7 @@ package main
import ( import (
"time" "time"
wails "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
) )

View File

@ -12,12 +12,12 @@ import (
type Runtime = runtime.Runtime type Runtime = runtime.Runtime
// CreateAppWithOptions creates an application based on the given config // CreateAppWithOptions creates an application based on the given config
func CreateAppWithOptions(options *options.App) *app.App { func CreateAppWithOptions(options *options.App) (*app.App, error) {
return app.CreateApp(options) return app.CreateApp(options)
} }
// CreateApp creates an application based on the given title, width and height // CreateApp creates an application based on the given title, width and height
func CreateApp(title string, width int, height int) *app.App { func CreateApp(title string, width int, height int) (*app.App, error) {
options := &options.App{ options := &options.App{
Title: title, Title: title,