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

View File

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

View File

@ -1,15 +1,22 @@
package main
import (
wails "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2"
"log"
)
func main() {
// 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.Run()
err = app.Run()
if err != nil {
log.Fatal(err)
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -56,11 +56,11 @@ func (s *ServerBuilder) BuildBaseAssets(assets *html.AssetBundle) error {
// Fetch, update, and reinject index.html
index, err := db.Read("index.html")
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>")
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>`
result := []string{}

View File

@ -5,7 +5,7 @@ import (
"testproject/mypackage"
wails "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2"
)
// Basic application struct
@ -56,11 +56,11 @@ func (b *Basic) Greet(name string) string {
}
// 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!"}
}
// RemovePerson Removes the given person
func (b *Basic) RemovePerson(p *mypackage.Person) {
func (b *Basic) RemovePerson(_ *mypackage.Person) {
// dummy
}

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
package main
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/mac"
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
package main
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/mac"
)

View File

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

View File

@ -12,12 +12,12 @@ import (
type Runtime = runtime.Runtime
// 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)
}
// 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{
Title: title,