5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-09 14:11:55 +08:00
wails/v3/internal/generator/testcases/complex_instantiations/main.go
Fabio Massaioli 9988b7eca8
[v3] Binding generator tests for Go 1.24 features (#4068)
* Enable go1.24 tests

This reverts commit e38684e7885c9c7b5ad3f704ad500c39bbce7715.

* Testdata for go1.24

This reverts commit 7ed397dc452f420551dfdd05dfe0c6a7646b3ba4.

* Require go 1.24

* Update changelog

* Add test for omitzero

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2025-02-28 07:21:51 +11:00

60 lines
1.4 KiB
Go

package main
import (
_ "embed"
"log"
"github.com/wailsapp/wails/v3/internal/generator/testcases/complex_instantiations/other"
"github.com/wailsapp/wails/v3/pkg/application"
)
type Service1 struct{}
type Service2 struct{}
type Service3 struct{}
type Service4 struct{}
type Service5 struct{}
type Service6 struct{}
type Service7 struct{}
type Service8 struct{}
type Service9 struct{}
type Service10 struct{}
type Service11 struct{}
type Service12 struct{}
type Service13 struct{}
type Service14 struct{}
type Service15 struct{}
type SimplifiedFactory[T any] = Factory[T, Service15]
func main() {
factory := NewFactory[Service1, Service2]()
otherFactory := other.NewFactory[Service3, Service4]()
app := application.New(application.Options{
Services: append(append(
[]application.Service{
factory.Get(),
factory.GetU(),
otherFactory.Get(),
otherFactory.GetU(),
application.NewService(&Service5{}),
ServiceInitialiser[Service6]()(&Service6{}),
other.CustomNewService(Service7{}),
other.ServiceInitialiser[Service8]()(&Service8{}),
application.NewServiceWithOptions(&Service13{}, application.ServiceOptions{Name: "custom name"}),
SimplifiedFactory[Service14]{}.Get(),
other.LocalService,
},
CustomNewServices[Service9, Service10]()...),
other.CustomNewServices[Service11, Service12]()...),
})
app.NewWebviewWindow()
err := app.Run()
if err != nil {
log.Fatal(err)
}
}