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

- Update out of sync go.mod with minimum go version - Check for minimum go version during build with build constraint “internal/goversion/build_constraint.go:9:2: MinGoVersionRequired (constant "You need Go 1.18 or newer to compile this program" of type string) is not used”
43 lines
965 B
Go
43 lines
965 B
Go
// Package wails is the main package of the Wails project.
|
|
// It is used by client applications.
|
|
package wails
|
|
|
|
import (
|
|
"github.com/wailsapp/wails/v2/internal/app"
|
|
_ "github.com/wailsapp/wails/v2/internal/goversion" // Add Compile-Time version check for minimum go version
|
|
"github.com/wailsapp/wails/v2/internal/signal"
|
|
"github.com/wailsapp/wails/v2/pkg/options"
|
|
)
|
|
|
|
// Run creates an application based on the given config and executes it
|
|
func Run(options *options.App) error {
|
|
|
|
if options.RGBA != nil {
|
|
println("---- WARNING ----")
|
|
println("The `RGBA` option has been deprecated. Please use `BackgroundColour`.")
|
|
|
|
if options.BackgroundColour == nil {
|
|
options.BackgroundColour = options.RGBA
|
|
}
|
|
}
|
|
|
|
// Call an Init method manually
|
|
err := Init()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
mainapp, err := app.CreateApp(options)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
signal.OnShutdown(func() {
|
|
mainapp.Shutdown()
|
|
})
|
|
|
|
signal.Start()
|
|
|
|
return mainapp.Run()
|
|
}
|