• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

fyne-io / fyne / 18807176232

25 Oct 2025 06:34PM UTC coverage: 61.057% (-0.004%) from 61.061%
18807176232

Pull #5989

github

Jacalz
Fix TODO regarding comparable map key
Pull Request #5989: RFC: Proof of concept for upgrading Go to 1.24

155 of 188 new or added lines in 62 files covered. (82.45%)

27 existing lines in 6 files now uncovered.

25609 of 41943 relevant lines covered (61.06%)

692.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

68.57
/cmd/fyne/internal/commands/package-web.go
1
package commands
2

3
import (
4
        "bytes"
5
        "path/filepath"
6
        "runtime"
7

8
        "fyne.io/fyne/v2/cmd/fyne/internal/templates"
9
)
10

11
func (p *Packager) packageWasm() error {
1✔
12
        appDir := util.EnsureSubDir(p.dir, "wasm")
1✔
13

1✔
14
        tpl := webData{
1✔
15
                AppName:    p.Name,
1✔
16
                AppVersion: p.AppVersion,
1✔
17
                WasmFile:   p.Name + ".wasm",
1✔
18
                IsReleased: p.release,
1✔
19
        }
1✔
20

1✔
21
        return tpl.packageWebInternal(appDir, p.exe, "", p.icon, p.release)
1✔
22
}
1✔
23

24
type webData struct {
25
        AppName    string
26
        AppVersion string
27
        WasmFile   string
28
        IsReleased bool
29
}
30

31
func (w webData) packageWebInternal(appDir string, exeWasmSrc string, exeJSSrc string, icon string, release bool) error {
1✔
32
        var tpl bytes.Buffer
1✔
33
        err := templates.IndexHTML.Execute(&tpl, w)
1✔
34
        if err != nil {
1✔
UNCOV
35
                return err
×
36
        }
×
37

38
        index := filepath.Join(appDir, "index.html")
1✔
39
        err = util.WriteFile(index, tpl.Bytes())
1✔
40
        if err != nil {
1✔
UNCOV
41
                return err
×
42
        }
×
43

44
        iconDst := filepath.Join(appDir, "icon.png")
1✔
45
        err = util.CopyFile(icon, iconDst)
1✔
46
        if err != nil {
1✔
UNCOV
47
                return err
×
48
        }
×
49

50
        spinnerLightFile := filepath.Join(appDir, "spinner_light.gif")
1✔
51
        err = util.WriteFile(spinnerLightFile, templates.SpinnerLight)
1✔
52
        if err != nil {
1✔
UNCOV
53
                return err
×
54
        }
×
55

56
        spinnerDarkFile := filepath.Join(appDir, "spinner_dark.gif")
1✔
57
        err = util.WriteFile(spinnerDarkFile, templates.SpinnerDark)
1✔
58
        if err != nil {
1✔
UNCOV
59
                return err
×
60
        }
×
61

62
        lightCSSFile := filepath.Join(appDir, "light.css")
1✔
63
        err = util.WriteFile(lightCSSFile, templates.CSSLight)
1✔
64
        if err != nil {
1✔
UNCOV
65
                return err
×
66
        }
×
67

68
        darkCSSFile := filepath.Join(appDir, "dark.css")
1✔
69
        err = util.WriteFile(darkCSSFile, templates.CSSDark)
1✔
70
        if err != nil {
1✔
UNCOV
71
                return err
×
72
        }
×
73

74
        goroot := runtime.GOROOT()
1✔
75
        wasmExecSrc := filepath.Join(goroot, "lib", "wasm", "wasm_exec.js")
1✔
76
        if !util.Exists(wasmExecSrc) { // Fallback for Go < 1.24:
1✔
NEW
77
                wasmExecSrc = filepath.Join(goroot, "misc", "wasm", "wasm_exec.js")
×
NEW
78
        }
×
79
        wasmExecDst := filepath.Join(appDir, "wasm_exec.js")
1✔
80
        err = util.CopyFile(wasmExecSrc, wasmExecDst)
1✔
81
        if err != nil {
1✔
82
                return err
×
83
        }
×
84

85
        exeWasmDst := filepath.Join(appDir, w.WasmFile)
1✔
86
        err = util.CopyFile(exeWasmSrc, exeWasmDst)
1✔
87
        if err != nil {
1✔
88
                return err
×
UNCOV
89
        }
×
90

91
        // Download webgl-debug.js directly from the KhronosGroup repository when needed
92
        if !release {
2✔
93
                webglDebugFile := filepath.Join(appDir, "webgl-debug.js")
1✔
94
                err := util.WriteFile(webglDebugFile, templates.WebGLDebugJs)
1✔
95
                if err != nil {
1✔
UNCOV
96
                        return err
×
UNCOV
97
                }
×
98
        }
99

100
        return nil
1✔
101
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc