5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 04:11:05 +08:00

Change: Order of generated bindings now consistent

Closes #1531
This commit is contained in:
Lea Anthony 2022-07-08 20:18:31 +10:00
parent 1cd31573a9
commit bf2d83d939
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -6,6 +6,7 @@ import (
"fmt"
"os"
"path/filepath"
"sort"
"strings"
"github.com/wailsapp/wails/v2/internal/fs"
@ -32,8 +33,17 @@ func (b *Bindings) GenerateGoBindings(baseDir string) error {
tsContent.WriteString(`// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
`)
// Sort the method names alphabetically
methodNames := make([]string, 0, len(methods))
for methodName := range methods {
methodNames = append(methodNames, methodName)
}
sort.Strings(methodNames)
var importNamespaces slicer.StringSlicer
for methodName, methodDetails := range methods {
for _, methodName := range methodNames {
// Get the method details
methodDetails := methods[methodName]
// Generate JS
var args slicer.StringSlicer