Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find way to have debug sessions directly from the IDE #768

Closed
eakeur opened this issue Aug 29, 2022 · 4 comments
Closed

Find way to have debug sessions directly from the IDE #768

eakeur opened this issue Aug 29, 2022 · 4 comments

Comments

@eakeur
Copy link

eakeur commented Aug 29, 2022

I'm trying to build an application with go-app and created a simple form to check if the library would meet the requirements of the app. Fortunately, it does, but I cannot debug the application after it is compiled. The only thing that the IDE listens to is the main function and the first render of the main page.

I would like to know if there is another way to debug it or if I am missing something like mappings that should be generated with the WASM (like JS mappings for chrome DevTools).

@oderwat
Copy link
Sponsor Contributor

oderwat commented Aug 29, 2022

You must distinguish between the server executable (backend) and the Wasm parts.

You can debug the back end like with every other Go code (Delve/IDEs).

Debugging in the front end means debugging the Wasm code inside the browser. This is possible, but the current implementation of the Go compiler and the debugger do not support the correct mappings.

This makes it pretty hard/useless because you do not see your Go code there (yet). I think this problem is worked on. It was solved for TinyGo some days ago (I have not tried it yet). I think this will happen to work with the standard Go compiler-generated Wasm eventually, too. If it will be "nice" to do is another question.

Resources:

As long as this is not possible, we are using the good old "print debugging," and we published some small packages to help with that by making it easy to see where calls to the log originated from: https://github.com/metatexx/go-app-pkgs/tree/master/dbg (best is to copy that, as we do guarantee nothing)

@gepengscu
Copy link

gepengscu commented Aug 30, 2022

@maxence-charriere did a lot job. You can debug ui in unit test like this:

func TestSomeUI(t *testing.T) {
	t.Run("aName",
		func(t *testing.T) {
			ui := newYourUI()
			d := app.NewClientTester(ui)
			defer d.Close()
			d.Consume()
			// call func of ui 
                        // ui.someFunc.......
                        // print...
		})
}

@eakeur
Copy link
Author

eakeur commented Jun 30, 2023

Any news on that now? I stopped using the framework due to some personal reasons but I'm coming back to it

@maxence-charriere
Copy link
Owner

Since the app run in a browser, this would require that the client send the logs to the server. No plan to add this to go-app but it should not be hard to implement it yourself if you need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants