-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
models.ts no longer generated after update to v2.9.2 #3809
Comments
Hey, I'm bumping into a similar issue after upgrading to In my case, I was relying on the fact that fields without a json tag are not generated. Now when I try to generate the bindings it panics.
I've reverted If a field is exported, generate json even in the absence of tags locally and everything works again. IMO, the fact that only fields with json tags were exported was a good design decision because it gives you control over what's exposed to the frontend. I'm wondering if we cannot find a middle ground by making this feature it opt-in or opt-out. |
I mean, it should never crash so I'd like to know what triggers this. To prevent export, just use non-exported values (lower case). |
That being said, I created a project from scratch and a simple method like the one below is crashing type TestStruct struct {
A string `json:"a"`
B string
}
func (a *App) Test() TestStruct {
return TestStruct{
A: "hello",
B: "test",
}
}
I'll dig more to find the root cause, I'm just wondering if you're having the same issue on your side. I'm running all the commands on my terminal. |
@BenoitBotton - I'm still really keen to understand how you got the nil pointer dereference - I couldn't reproduce, even with your example. Please try the above PR to see if this fixes your problem. If you are unsure how to do this, please follow this guide. Let us know how you get on 👍 |
I suspect the original issue here is the menu package not being scanned for export? Is it the only value expected in models.ts or are other structures not exported? @fkhadra That sounds like a different issue since it’s crashing. If you mark the field tags as |
WailsVersion | v2.9.2 System┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ Dependencies┌─────────────────────────────────────────────────────────────────────┐ DiagnosisOptional package(s) installation details:
SUCCESS Your system is ready for Wails development! |
hmmm, no crash either under windows. But on closer inspection, models.ts is not generated and I get the below error:
edit: having gone back to linux, I get the same error |
same thing if I use the PR |
going back to the app in which I found the issue (I can't share that unfortunately), the models.ts is still deleted and the frontend doesn't build due to typescript errors. using the PR does not change anything |
So in my case,
I'm trying to understand where the nil pointer dereference could come from, I'm a bit confused. |
I have more update, after deleting On my other project though, the nil pointer issue is gone but the |
OK, After digging in a bit, my initial thought was wrong. It looks like this is triggered when trying to marshal Go-Exported values that are not json encodable (aka channel, complex numbers, or in this case, a callback function) Specifically, the So right before the |
thanks @pbnjay |
Description
After updating wails to v2.9.2 (from v2.9.1) models.ts is no longer generated and therefore the frontend fails to build due to typescript errors.
No error is output by typescriptify
To Reproduce
have menu callbacks defined as app methods (so they can be called from frontend)
reproduction here: https://github.com/BenoitBotton/test
Expected behaviour
project runs with
wails dev
or builds withwails build
Screenshots
No response
Attempted Fixes
git bisect gives the following:
System Details
Additional context
this can obviously be avoided in my project by making the app methods not be menu callbacks, and call them in callback definitions in main.go
The text was updated successfully, but these errors were encountered: