text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>package collect
import (
"fmt"
"go/ast"
"go/types"
"strconv"
"sync"
"github.com/wailsapp/wails/v3/internal/hash"
"golang.org/x/tools/go/types/typeutil"
)
type (
// ServiceInfo records all information that is required
// to render JS/TS code for a service type.
//
// Read accesses to any publ... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect
import "time"
type Stats struct {
NumPackages int
NumServices int
NumMethods int
NumEnums int
NumModels int
NumEvents int
StartTime time.Time
EndTime time.Time
}
func (stats *Stats) Start() {
stats.StartTime = time.Now()
stats.EndTime = stat<|fim_suffix|> {
retu... | fim | wailsapp/wails | go |
<|fim_prefix|>package collect
import (
"cmp"
"go/ast"
"go/types"
"reflect"
"slices"
"strings"
"sync"
"unicode"
)
type (
// StructInfo records the flattened field list for a struct type,
// taking into account JSON tags.
//
// The field list is initially empty. It will be populated
// upon calling [Struct... | fim | wailsapp/wails | go |
<|fim_suffix|>th shape: *ast.TypeSpec, *ast.GenDecl, *ast.File
tspec := path[0].(*ast.TypeSpec)
// Retrieve doc comments.
info.Doc = tspec.Doc
if info.Doc == nil {
info.Doc = tspec.Comment
} else if tspec.Comment != nil {
info.Doc = &ast.CommentGroup{
List: slices.Concat(tspec.Doc.List, tspec.Comme... | fim | wailsapp/wails | go |
<|fim_suffix|>ore package to fail fast
// Cache void alias for faster checking
collector.appVoidType.Store(obj)
return true
}
return false
}
<|fim_prefix|>package collect
import (
"go/types"
)
// IsVoidAlias returns true when the given type or object is the application.Void named type that stands in for the... | fim | wailsapp/wails | go |
<|fim_suffix|>n nil, err
}
return os.Create(path)
})
}
type nullWriteCloser struct{}
func (nullWriteCloser) Write(data []byte) (int, error) {
return len(data), nil
}
func (nullWriteCloser) Close() error {
return nil
}
<|fim_prefix|>package config
import (
"io"
"os"
"path/filepath"
)
// FileCreator abstr... | fim | wailsapp/wails | go |
<|fim_prefix|>package config
import (
"fmt"
"github.com/pterm/pterm"
)
// A Logger instance provides methods to format and report messages
// intended for the end user.
//
// All Logger methods may be called concurrently by its consumers.
type Logger interface {
// Errorf should process its arguments as if they w... | fim | wailsapp/wails | go |
<|fim_prefix|>package config
// WailsAppPkgPath is the official impo<|fim_suffix|>/pkg/application"
// WailsInternalPkgPath is the official import path of Wails v3's internal package.
const WailsInternalPkgPath = "github.com/wailsapp/wails/v3/internal"
// SystemPaths holds resolved paths of required system packages.... | fim | wailsapp/wails | go |
<|fim_suffix|>ata, parser.AllErrors)
if err != nil {
return "", err
}
// Extract constant declarations and generate JavaScript constants
var jsConstants []string
for _, decl := range f.Decls {
if gd, ok := decl.(*ast.GenDecl); ok && gd.Tok == token.CONST {
for _, spec := range gd.Specs {
if vs, ok := s... | fim | wailsapp/wails | go |
<|fim_suffix|> {
name: "string",
goData: []byte(`package test
const one_as_a_string = "1"`),
want: `export const one_as_a_string = "1";`,
wantErr: false,
},
{
name: "nested",
goData: []byte(`package test
const (
one_as_a_string = "1"
)`),
want: `export const one_as_a_string = "1";`,
... | fim | wailsapp/wails | go |
<|fim_suffix|>instance provided during initialisation.
//
// This method is here just for convenience and performs no deduplication.
func (report *ErrorReport) Debugf(format string, a ...any) {
report.logger.Debugf(format, a...)
}
// Statusf forwards the given status message
// to the logger instance provided during ... | fim | wailsapp/wails | go |
<|fim_suffix|>"event data table generation failed")
return
}
defer func() {
if err := file.Close(); err != nil {
generator.logger.Errorf("%v", err)
generator.logger.Errorf("event data table generation failed")
}
}()
err = generator.renderer.EventData(file, events)
if err != nil {
generato... | fim | wailsapp/wails | go |
<|fim_suffix|>ted bindings emitter to detect when the metadata
// file lives in the same package as a service and elide the self-import.
func buildDirToPkgPath(pkgs []*packages.Package) map[string]string {
out := make(map[string]string, len(pkgs))
for _, pkg := range pkgs {
if len(pkg.GoFiles) == 0 || pkg.PkgPath =... | fim | wailsapp/wails | go |
<|fim_prefix|>package generator
import (
"errors"
"fmt"
"io"
"io/fs"
"os"
"path/filepath"
"slices"
"strings"
"sync"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/wailsapp/wails/v3/internal/flags"
"github.com/wailsapp/wails/v3/internal/generator/config"
"github.com/wailsapp/wails/v3/internal/gener... | fim | wailsapp/wails | go |
<|fim_suffix|> indexes",
index.Package.Path,
path,
)
return
}
}
// Validate against services.
service, ok := slices.BinarySearchFunc(index.Services, name, func(service *collect.ServiceInfo, name string) int {
return strings.Compare(generator.renderer.ServiceFile(service.Name), name)
})
... | fim | wailsapp/wails | go |
<|fim_prefix|>package generator
import (
"path/filepath"
"github.com/wailsapp/wails/v3/int<|fim_suffix|>ndex) {
defer generator.reportDualRoles(index)
file, err := generator.creator.Create(filepath.Join(index.Package.Path, generator.renderer.IndexFile()))
if err != nil {
generator.logger.Errorf("%v", err)
g... | fim | wailsapp/wails | go |
<|fim_suffix|>e Go maintainers now believe deprecation was an error and recommend using Load* modes
// (see e.g. https://github.com/golang/go/issues/48226#issuecomment-1948792315).
Mode: packages.LoadAllSyntax,
BuildFlags: buildFlags,
Fset: fset,
ParseFile: func(fset *token.FileSet, filename strin... | fim | wailsapp/wails | go |
<|fim_suffix|>mports.
imports.ImportModels = false
file, err := generator.creator.Create(filepath.Join(info.Path, generator.renderer.ModelsFile()))
if err != nil {
generator.logger.Errorf("%v", err)
generator.logger.Errorf("package %s: models generation failed", info.Path)
return
}
defer func() {
if err :... | fim | wailsapp/wails | go |
<|fim_prefix|>package render
import (
"fmt"
"go/types"
"strings"
"text/template"
"github.com/wailsapp/wails/v3/internal/generator/collect"
)
// SkipCreate returns true if the given array of types needs no creation code.
func (m *module) SkipCreate(ts []types.Type) bool {
for _, typ := range ts {
if m.NeedsCr... | fim | wailsapp/wails | go |
<|fim_suffix|>j().Pkg().Path() == m.Imports.Self {
return fmt.Sprintf("(new %s%s())", prefix, jsid(typ.Obj().Name())), true
} else {
return fmt.Sprintf("(new %s.%s())", jsimport(m.Imports.External[typ.Obj().Pkg().Path()]), jsid(typ.Obj().Name())), true
}
} else if _, isAlias := typ.(*types.Alias); isAlias {
... | fim | wailsapp/wails | go |
<|fim_prefix|>package render
import (
"bufio"
"bytes"
"go/ast"
"strings"
"unicode"
"github.com/wailsapp/wails/v3/internal/generator/collect"
)
// hasdoc checks whether the given comment group contains actual doc comments.
func hasdoc(group *ast.CommentGroup) bool {
if group == nil {
return false
}
// TOD... | fim | wailsapp/wails | go |
<|fim_prefix|>package render
import (
"fmt"
"go/types"
"math/big"
"strconv"
"strings"
"text/template"
"github.com/wailsapp/wails/v3/internal/generator/collect"
)
// tmplFunctions holds a map of utility functions
// that should be available in every template.
var tmplFunctions = template.FuncMap{
"fixext": ... | fim | wailsapp/wails | go |
package render
import (
"slices"
)
// jsid escapes identifiers that match JS/TS reserved words
// by prepending a dollar sign.
func jsid(ident string) string {
if _, reserved := slices.BinarySearch(protectedWords, ident); reserved {
return "$" + ident
}
return ident
}
func init() {
// Ensure reserved words ar... | fim | wailsapp/wails | go |
<|fim_suffix|>en(model.Values) > 0
info.IsEnum = info.HasValues && !model.Alias
info.IsAlias = !info.IsEnum && model.Type != nil
info.IsClassAlias = info.IsAlias && model.Predicates.IsClass && !useInterfaces
info.IsTypeAlias = info.IsAlias && !info.IsClassAlias
info.IsClassOrInterface = !info.IsEnum && !info.IsA... | fim | wailsapp/wails | go |
<|fim_prefix|>package r<|fim_suffix|>Renderer
*flags.GenerateBindingsOptions
Imports *collect.ImportMap
postponedCreates typeutil.Map
}
// Runtime returns the import path for the Wails JS runtime module.
func (m *module) Runtime() string {
if m.UseBundledRuntime {
return "/wails/runtime.js"
} else {
return ... | fim | wailsapp/wails | go |
<|fim_prefix|>package render
import (
"go/types"
"io"
"slices"
"strings"
"text/template"
"github.com/wailsapp/wails/v3/internal/flags"
"github.com/wailsapp/wails/v3/internal/generator/collect"
)
// Renderer holds the template set for a given configuration.
// It provides methods for rendering various output m... | fim | wailsapp/wails | go |
<|fim_prefix|>package render
import (
"embed"
"strings"
"text/template"
)
//go:embed templates/*.tmpl
var templates embed.FS
type tmplLanguage bool
const tmplJS, tmplTS tmplLanguage = false, true
var tmplService = map[tmplLanguage]*template.Template{
tmplJS: template.Must(template.New("service.js.tmpl").Funcs(... | fim | wailsapp/wails | go |
<|fim_suffix|>
}
if quoted {
switch a := types.Unalias(typ).(type) {
case *types.Basic:
// Quoted mode for (alias of?) basic type: delegate.
return m.renderBasicType(a, quoted), false
case *types.TypeParam:
// Quoted mode for (alias of?) typeparam: delegate.
return m.renderType(a, quoted)
case *t... | fim | wailsapp/wails | go |
package generator
import (
"go/types"
"path/filepath"
)
// generateService collects information
// and generates JS/TS binding code
// for the given service type object.
func (generator *Generator) generateService(obj *types.TypeName) {
generator.logger.Debugf(
"discovered service type %s from package %s",
obj... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"encoding"
"log"
"github.com/wailsapp/wails/v3/internal/generator/testcases/aliases/subpkg"
nobindingshere "github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
type GreetService ... | fim | wailsapp/wails | go |
<|fim_prefix|>package subpkg
// SubStruct is a type in a subpackage that is only referen<|fim_suffix|>tring
}
<|fim_middle|>ced through an alias.
type SubStruct struct {
SomeField []s<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package config
import "github.com/wailsapp/wails/v3/pkg/application"
type Service7 struct{}
type Service8 struct{}
type Service9 struct{}
type Service10 struct{}
type Service11 struct{}
type Service12 struct{}
func (*Service7) TestMethod() {}
func (*Service9) TestMethod2() {}
func NewService7() appli... | fim | wailsapp/wails | go |
<|fim_suffix|>().InitProvider(&services[3])
copy(options.Services, []application.Service{application.NewService(&Service4{}), provider.HeresAnotherOne, provider.OtherService.(application.Service)})
(options.Services) = append(options.Services, slices.Insert(services, 1, GlobalServices[2:]...)...)
app := applicatio... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import "<|fim_suffix|>y[T any, U any]() *Factory[T, U] {
return &Factory[T, U]{}
}
func (*Factory[T, U]) GetU() application.Service {
return application.NewService(new(U))
}
type simpleFactory[T any] struct{}
func (simpleFactory[U]) Get() application.Service {
return application.NewSer... | fim | wailsapp/wails | go |
package main
import "github.com/wailsapp/wails/v3/pkg/application"
func ServiceInitialiser[T any]() func(*T) application.Service {
return application.NewService[T]
}
func CustomNewServices[T any, U any]() []application.Service {
return []application.Service{
application.NewService(new(T)),
application.NewServi... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"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 struc... | fim | wailsapp/wails | go |
package other
import "github.com/wailsapp/wails/v3/pkg/application"
type Factory[T any, U any] struct {
simpleFactory[T]
}
func NewFactory[T any, U any]() *Factory[T, U] {
return &Factory[T, U]{}
}
func (*Factory[T, U]) GetU() application.Service {
return application.NewService(new(U))
}
type simpleFactory[T an... | fim | wailsapp/wails | go |
<|fim_prefix|>package other
import "github.com/wailsapp/wails/v3/pkg/application"
func CustomNewService[T any](srv T) application.Service {
return appl<|fim_suffix|>[]application.Service{
application.NewService(new(T)),
application.NewService(new(U)),
}
}
<|fim_middle|>ication.NewService(&srv)
}
func ServiceIn... | fim | wailsapp/wails | go |
<|fim_prefix|>package other
import "github.com/wailsapp/wails/v3/pkg/application"
type Service16<|fim_suffix|>new(Service16))
<|fim_middle|> int
var LocalService = application.NewService(<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
// Title is a title
type Title string
const (
// Mister is a title
Mister Title = "Mr"
Miss Title = "Miss<|fim_suffix|>
// unexportedToo should be invisible even with a json tag
unexportedToo bool `json:"Unexported"... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
type GreetService struct{}
// Person represents a person
type Person struct {
Name string
}
// Greet does XYZ
// It has a multiline doc comment
// The comment has even some */ traps!!
func (*Greet... | fim | wailsapp/wails | go |
package main
import (
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
type GreetService int
type StructA struct {
B *structB
}
type structB struct {
A *StructA
}
type StructC struct {
D structD
}
type structD struct {
E StructE
}
type StructE struct{}
// Make a cycle.
func... | fim | wailsapp/wails | go |
<|fim_suffix|>Cyclic[int]]) {
return
}
func NewGreetService() application.Service {
return application.NewService(new(GreetService))
}
func main() {
app := application.New(application.Options{
Services: []application.Service{
NewGreetService(),
},
})
app.Window.New()
err := app.Run()
if err != nil {
... | fim | wailsapp/wails | go |
<|fim_prefix|>//wails:include js/test.js
//wails:include **:js/test_all.j<|fim_suffix|>_j.js
//wails:include jc:js/test_jc.js
//wails:include ji:js/test_ji.js
//wails:include t*:js/test_t.ts
//wails:include tc:js/test_tc.ts
//wails:include ti:js/test_ti.ts
package main
<|fim_middle|>s
//wails:include *c:js/test_c.js
//... | fim | wailsapp/wails | go |
<|fim_suffix|>ethod(InternalModel) {}
<|fim_prefix|>package main
// An exported but internal model.
//
//wails:internal
type InternalModel struct {
Field <|fim_middle|>string
}
// An exported but internal service.
//
//wails:internal
type InternalService struct{}
func (InternalService) M<|endoftext|> | fim | wailsapp/wails | go |
<|fim_suffix|>rom "./service.js";
CustomMethod("everywhere");
<|fim_prefix|><|fim_middle|>import { CustomMethod } f<|endoftext|> | fim | wailsapp/wails | javascript |
<|fim_prefix|>import { Custo<|fim_suffix|>
CustomMethod("everywhere again");
<|fim_middle|>mMethod } from "./service.js";
<|endoftext|> | fim | wailsapp/wails | javascript |
import { CustomMethod } from "./service.js";
CustomMethod("Classes");
<|endoftext|> | fim | wailsapp/wails | javascript |
import { CustomMethod } from "./service.js";
CustomMethod("Interfaces");
<|endoftext|> | fim | wailsapp/wails | javascript |
<|fim_prefix|>i<|fim_suffix|>stomMethod("JS");
<|fim_middle|>mport { CustomMethod } from "./service.js";
Cu<|endoftext|> | fim | wailsapp/wails | javascript |
<|fim_prefix|>import {<|fim_suffix|>("JS Classes");
<|fim_middle|> CustomMethod } from "./service.js";
CustomMethod<|endoftext|> | fim | wailsapp/wails | javascript |
<|fim_suffix|>"JS Interfaces");
<|fim_prefix|>import { CustomMethod } from "./<|fim_middle|>service.js";
CustomMethod(<|endoftext|> | fim | wailsapp/wails | javascript |
<|fim_prefix|>import {<|fim_suffix|>mMethod("TS");
<|fim_middle|> CustomMethod } from "./service.js";
Custo<|endoftext|> | fim | wailsapp/wails | typescript |
<|fim_suffix|>";
CustomMethod("TS Classes");
<|fim_prefix|>import { CustomMethod } from <|fim_middle|>"./service.js<|endoftext|> | fim | wailsapp/wails | typescript |
<|fim_suffix|>mMethod("TS Interfaces");
<|fim_prefix|>import { CustomMethod } from<|fim_middle|> "./service.js";
Custo<|endoftext|> | fim | wailsapp/wails | typescript |
<|fim_prefix|>//wails:inject console.lo<|fim_suffix|>o everywhere again!");
//wails:inject *c:console.log("Hello Classes!");
//wails:inject *i:console.log("Hello Interfaces!");
//wails:inject j*:console.log("Hello JS!");
//wails:inject jc:console.log("Hello JS Classes!");
//wails:inject ji:console.log("Hello JS Interfa... | fim | wailsapp/wails | go |
<|fim_suffix|>
<|fim_prefix|>//wails:include jc:js/*_j*.js
//wa<|fim_middle|>ils:include tc:js/*_t*.ts
package otherpackage
type Dummy struct{}<|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>import { CustomMethod } from "../service.<|fim_suffix|>");
<|fim_middle|>js";
CustomMethod("JS<|endoftext|> | fim | wailsapp/wails | javascript |
<|fim_prefix|>import { Custom<|fim_suffix|>from "../service.js";
CustomMethod("JS Classes");
<|fim_middle|>Method } <|endoftext|> | fim | wailsapp/wails | javascript |
<|fim_prefix|>import { <|fim_suffix|>;
CustomMethod("TS");
<|fim_middle|>CustomMethod } from "../service.js"<|endoftext|> | fim | wailsapp/wails | typescript |
<|fim_suffix|>from "../service.js";
CustomMethod("TS Classes");
<|fim_prefix|>import { CustomMetho<|fim_middle|>d } <|endoftext|> | fim | wailsapp/wails | typescript |
<|fim_prefix|>package main
// An unexported model.
type unexportedModel struct {
Field string
}
// An unexported service.
type unexportedService<|fim_suffix|>struct{}
func (unexportedService) Method(unexportedModel) {}
<|fim_middle|> <|endoftext|> | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
type GreetService struct {
AnInterface
}
type AnInterface interface {
// Comment 1.
Method1()
Method2() // Comment 2.
// Comment 3a.
Method3() // Comment 3b.
interface {
// Com<|fim_suff... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
// Title is a title
type Title string
const (
// Mister is a title
Mister Title = "Mr"
Miss Title = "Miss"
Ms Title = "Ms"
Mrs Title = "Mrs"
Dr Title = "Dr"
)
// Age is an integer with some predefined va... | fim | wailsapp/wails | go |
<|fim_suffix|>.Run()
if err != nil {
log.Fatal(err)
}
}
<|fim_prefix|>package main
import (
"log"
"github.com/wailsapp/wails/v3/internal/generator/testcases/enum_from_imported_package/services"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
type GreetService struct {
SomeVariabl... | fim | wailsapp/wails | go |
<|fim_suffix|>s Title = "Ms"
Mrs Title = "Mrs"
Dr Title = "Dr"
)
<|fim_prefix|>package services
type Title string
func (t Title) String() string {
return str<|fim_middle|>ing(t)
}
const (
// Mister is a title
Mister Title = "Mr"
Miss Title = "Miss"
M<|endoftext|> | fim | wailsapp/wails | go |
package main
import (
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
// Status represents different status values
type Status string
const (
StatusPending Status = "pending"
StatusRunning Status = "running"
StatusCompleted Status = "completed"
StatusFailed Status = "failed"
)
// Priority repre... | fim | wailsapp/wails | go |
<|fim_suffix|>g
Meadow nobindingshere.HowDifferent[rune]
}
func init() {
application.RegisterEvent[string]("events_only:string")
application.RegisterEvent[map[string][]int]("events_only:map")
application.RegisterEvent[SomeClass]("events_only:class")
application.RegisterEvent[int]("collision")
application.Registe... | fim | wailsapp/wails | go |
<|fim_prefix|>p<|fim_suffix|>ases/no_bindings_here/more"
"github.com/wailsapp/wails/v3/pkg/application"
)
const eventPrefix = "events_only" + `:`
var registerStringEvent = application.RegisterEvent[string]
func registerIntEvent(name string) {
application.RegisterEvent[int](name)
}
func registerSliceEvent[T any]()... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"log"
"github.com/wailsapp/wails/v3/internal/generator/testcases/function_from_imported_package/services"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
type GreetService struct {
SomeVariable int
lowerCase string
target *Person
}
// Per... | fim | wailsapp/wails | go |
<|fim_suffix|>t string
State string
Country string
}
// Yay does this and that
func (o *OtherService) Yay() *Address {
return &Address{
Street: "123 Pitt Street",
State: "New South Wales",
Country: "Australia",
}
}
func NewOtherService() application.Service {
return application.NewService(&OtherServi... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"log"
"github.com/wailsapp/wails/v3/internal/generator/testcases/func<|fim_suffix|>e int
lowerCase string
target *Person
}
type Person struct {
Name string
Address *other.Address
}
// Greet does XYZ
func (*GreetService) Greet(name string) string {
return "Hello... | fim | wailsapp/wails | go |
<|fim_prefix|>package other
import "github.com/wailsapp/wails/v3/pkg/application"
// OtherService is a s<|fim_suffix|>t: "123 Pitt Street",
State: "New South Wales",
Country: "Australia",
}
}
func NewOtherService() application.Service {
return application.NewService(&OtherService{})
}
<|fim_middle|>truct
//... | fim | wailsapp/wails | go |
<|fim_suffix|>reetService() application.Service {
return application.NewService(&GreetService{})
}
<|fim_prefix|>package main
import (
"github.com/wailsapp/wails/v3/pkg/application"
)
type GreetService struct {
SomeVariable<|fim_middle|> int
lowerCase string
}
func (*GreetService) Greet(name string) string {
... | fim | wailsapp/wails | go |
<|fim_suffix|>
if err != nil {
log.Fatal(err)
}
}
<|fim_prefix|>package main
import (
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
func main() {
app := application.New(application.Options{
Services: []application.Service{
NewGreetService(),
},
})
app.Window.New()
err := <|fim_middle|>ap... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
// Gr<|fim_suffix|> err != nil {
log.Fatal(err)
}
}
<|fim_middle|>eetService is great
type GreetService struct {
SomeVariable int
lowerCase string
}
// Greet someone
func (*GreetService) Greet(name string) string {... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"context"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
type GreetService struct {
SomeVariable int
lowerCase string
}
// Greet someone
func (*Gr<|fim_suffix|>llo " + name
}
func NewGreetService() application.Service {
return applicati... | fim | wailsapp/wails | go |
<|fim_suffix|>.New(application.Options{
Services: []application.Service{
NewGreetService(),
},
})
app.Window.New()
err := app.Run()
if err != nil {
log.Fatal(err)
}
}
<|fim_prefix|>package main
import (
"context"
"log"
"net/http"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"encoding"
"encoding/json"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
type Service struct{}
type NonTextMarshaler struct{}
type ValueTextMarshaler struct{}
func (ValueTextMarshaler) MarshalText() ([]byte, error) { return nil, nil }
type PointerTextMarshaler str... | fim | wailsapp/wails | go |
package main
import (
"encoding"
"encoding/json"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
type Service struct{}
// class {}
type NonMarshaler struct{}
// any
type ValueJsonMarshaler struct{}
func (ValueJsonMarshaler) MarshalJSON() ([]byte, error) { return nil, nil }
// any
type PointerJsonMarsh... | fim | wailsapp/wails | go |
package more
// StringPtr is a nullable string.
type StringPtr *string
<|endoftext|> | fim | wailsapp/wails | go |
package other
// OtherMethods has another method, but through a private embedded type.
type OtherMethods struct {
otherMethodsImpl
}
type otherMethodsImpl int
// LikeThisOtherOne does nothing as well, but is different.
func (*otherMethodsImpl) LikeThisOtherOne() {}
<|endoftext|> | fim | wailsapp/wails | go |
package other
// OtherPerson is like a person, but different.
type OtherPerson[T any] struct {
// They have a name as well.
Name string
// But they may have many differences.
Differences []T
}
<|endoftext|> | fim | wailsapp/wails | go |
package nobindingshere
import "github.com/wailsapp/wails/v3/internal/generator/testcases/no_bindings_here/other"
// Person is not a number.
type Person struct {
// They have a name.
Name string
Friends [4]Impersonator // Exactly 4 sketchy friends.
}
// Impersonator gets their fields from other people.
type Imp... | fim | wailsapp/wails | go |
<|fim_suffix|>type SomeMethods struct {
other.OtherMethods
}
// LikeThisOne is an example method that does nothing.
func (SomeMethods) LikeThisOne() (_ Person, _ HowDifferent[bool], _ PrivatePerson) {
return
}
<|fim_prefix|>package nobindingshere
import "github.com/wailsapp/wails/v3/internal/generator/testcases/no_... | fim | wailsapp/wails | go |
<|fim_suffix|> (*GreetService) Greet(string) {}
func main() {
app := application.New(application.Options{
Services: []application.Service{
application.NewService(new(GreetService)),
application.NewService(&EmbedService{}),
application.NewService(&EmbedOther{}),
application.NewService(&nobindingshere.Som... | fim | wailsapp/wails | go |
package main
import (
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
type GreetService struct {
SomeVariable int
lowerCase string
}
func (*GreetService) Greet(name string) string {
return "Hello " + name
}
type OtherService struct {
t int
}
func (o *OtherService) Hello() {}
func main() {
app :=... | fim | wailsapp/wails | go |
<|fim_suffix|>}
<|fim_prefix|>package main
type GreetService struct {
SomeVaria<|fim_middle|>ble int
lowerCase string
}
func (*GreetService) Greet(name string) string {
return "Hello " + name
<|endoftext|> | fim | wailsapp/wails | go |
<|fim_suffix|>al(err)
}
}
<|fim_prefix|>package main
import (
"log"
"github.com/<|fim_middle|>wailsapp/wails/v3/pkg/application"
)
func main() {
app := application.New(application.Options{
Services: []application.Service{
application.NewService(&GreetService{}),
application.NewService(&OtherService{}),
... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
type Other<|fim_suffix|>vice) Hello() {}
<|fim_middle|>Service struct {
t int
}
func (o *OtherSer<|endoftext|> | fim | wailsapp/wails | go |
package main
import (
"log"
"github.com/wailsapp/wails/v3/internal/generator/testcases/struct_literal_multiple_other/services"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
type GreetService struct {
SomeVariable int
lowerCase string
target *Person
}
type Person struct {
... | fim | wailsapp/wails | go |
<|fim_prefix|>package services
// OtherService is a struct
// that does things
type OtherService struct {
t int
}
type Address struct {
Street string
State string
Country string
}
// Yay does this and that
func (o *OtherService) Yay() *Address {
return &Address{
<|fim_suffix|>Country: "Australia",
}
}
<|f... | fim | wailsapp/wails | go |
<|fim_suffix|> return in
}
func (GreetService) UInt32PointerInAndOutput(in *uint32) *uint32 {
return in
}
func (GreetService) UInt64PointerInAndOutput(in *uint64) *uint64 {
return in
}
func (GreetService) IntPointerInAndOutput(in *int) *int {
return in
}
func (GreetService) Int8PointerInAndOutput(in *int8) *int8... | fim | wailsapp/wails | go |
<|fim_suffix|>e) UIntPointerInAndOutput(in *uint) *uint {
return in
}
func (*GreetService) UInt8PointerInAndOutput(in *uint8) *uint8 {
return in
}
func (*GreetService) UInt16PointerInAndOutput(in *uint16) *uint16 {
return in
}
func (*GreetService) UInt32PointerInAndOutput(in *uint32) *uint32 {
return in
}
func ... | fim | wailsapp/wails | go |
<|fim_suffix|>eturn AllTypes{}
}
func main() {
app := application.New(application.Options{
Services: []application.Service{
application.NewService(&TypeMappingService{}),
},
})
app.Window.New()
err := app.Run()
if err != nil {
log.Fatal(err)
}
}
<|fim_prefix|>package main
import (
"log"
"time"
"... | fim | wailsapp/wails | go |
package main
import (
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
type GreetService struct {
SomeVariable int
lowerCase string
}
// Greet someone
func (*GreetService) Greet(name string) string {
return "Hello " + name
}
func main() {
greetService := application.NewServi... | fim | wailsapp/wails | go |
<|fim_suffix|>.NewService(&GreetService{})
}
func main() {
greetService := NewGreetService()
app := application.New(application.Options{
Services: []application.Service{
greetService,
},
})
_ = app.Window.New() // discard
// or: win := app.Window.New() // keep for later
err := app.Run()
if err != nil ... | fim | wailsapp/wails | go |
<|fim_prefix|>package main
import (
"log"
"github.com/wailsapp/wails/v3/internal/generator/testcases/variable_single_from_oth<|fim_suffix|>function/services"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
type GreetService struct {
SomeVariable int
lowerCase string
target *... | fim | wailsapp/wails | go |
<|fim_prefix|>package services
import "github.com/wailsapp/wails/v3/pkg/application"
// OtherService is a struct
// that does things
type OtherService struct {
t int
}
type Address struct {
Stre<|fim_suffix|>e) Yay() *Address {
return &Address{
Street: "123 Pitt Street",
State: "New South Wales",
Country... | fim | wailsapp/wails | go |
<|fim_prefix|>// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as $models from "./models.js";
<|fim_suffix|>des the receiver into UTF-8-encoded text and returns the result.
* @typedef {$models.TextMarshaler} TextMarshaler
*/
<|fim_m... | fim | wailsapp/wails | javascript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.