Closed OwOday closed 11 months ago
Trying to give some first-aid I would forward a stack overflow answer.
Can you try again after running:
go clean -modcache
Ref.: https://stackoverflow.com/a/73531307/18392410
To further analyze the problem if it doesn't work, can you please try to run the example relative to the package, and report the result? For this you clone the repository and copy or move the examples directory into the v2/
directory. If you run them here, they will use the relative package.
Like the readme instructcs: https://github.com/webui-dev/go-webui#as-git-clone-in-a-local-directory
I tried the modcache thing before this post hmm, I think I got something working by enabling cgo, is that a requirement of this project?: install https://jmeubank.github.io/tdm-gcc/download/
go env -w CGO_ENABLED=1
go build
and then changing the code to:
w := webui.NewWindow()
webui.Show(w, "<html>Hello World</html>")
webui.Wait()
produces no errors but nothing seems to happen, I'm probably doing something wrong
Seems like NewWindow doesnt really do anything, is this because I have webui setup wrong?
ah, I got it working haha
The things I did above + go run .
Glad to hear it works. Yep, you need to run the program :D!
Explicitly enabling cgo is usually not required. But I guess it can be required depending on the setup. If you run into more issues, don't hesitate to reach out! Best with such step by step reproductions like you did then the issues gets more clear, and it's easier to help!
Is there a version of examples that uses the new api?
Yes, the current examples in the repository use it. They are made to work with the latest webui version and are not compatible with versions earlier than 2.4.0.
E.g.: https://github.com/webui-dev/go-webui/blob/main/examples/call_go_from_js.go
Oh, for some reason my api looks more like this: https://pkg.go.dev/github.com/webui-dev/go-webui/v2@v2.4.0 which doesnt work with the example you listed
Oh yeah, the wrapper got a re-write that fixed all known bugs and improved the setup process and the API. The version that you are linking might have a lot of things that do not work right. The readme currently lists to install it via:
go get github.com/webui-dev/go-webui/v2/@v2.4.0-beta.1
This will give you the version you see in the example. Another tag with this new version will be released soon.
First I did this:
go get github.com/webui-dev/go-webui/v2/@v2.4.0-beta.1
irm https://raw.githubusercontent.com/webui-dev/go-webui/main/setup.ps1 | iex
then I still had to do this
I tried the modcache thing before this post hmm, I think I got something working by enabling cgo, is that a requirement of this project?: install https://jmeubank.github.io/tdm-gcc/download/
go env -w CGO_ENABLED=1 go build
but now the example code works as expected :)
Another thing that comes to my mind now that I know about the version. It might have been necessary to explicitly enable CGO with that version. You can check if it's still required after you have made the update.
I get the following while trying to import go-webui/v2 after installing it every way that the readme describes: