Reputation: 1179
i was checking the possibility to use fyne in browser using Web Assembly , but i am getting error ...
main.go :
package main
import (
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
w := a.NewWindow("Hello")
hello := widget.NewLabel("Hello Fyne!")
w.SetContent(container.NewVBox(
hello,
widget.NewButton("Hi!", func() {
hello.SetText("Welcome :)")
}),
))
w.ShowAndRun()
}
i ran this command ,
GOOS=js GOARCH=wasm go build -o main.wasm main.go
Output (error) :
package command-line-arguments
imports fyne.io/fyne/v2/app
imports fyne.io/fyne/v2/internal/driver/glfw
imports fyne.io/fyne/v2/internal/driver/common
imports fyne.io/fyne/v2/internal/painter/gl
imports github.com/go-gl/gl/v3.2-core/gl: build constraints exclude all Go files in /home/ahmed/go/pkg/mod/github.com/go-gl/[email protected]/v3.2-core/gl
Upvotes: 3
Views: 1712
Reputation: 3265
The ability to run in a browser is now in testing. You can use the Fyne develop
branch and install that version of the fyne
tool, then run:
$ fyne serve
It will load your Fyne app via a web server on port :8080.
Upvotes: 3
Reputation: 3265
Fyne does not yet support web assembly or delivering through a browser. You can watch our Tech Preview video from FyneConf last week to get an update on this work. https://youtu.be/t8gEzPujIVI
Upvotes: 2