wails
wails copied to clipboard
Slice of array causes `wails generate module` to fail
Description
wails generate module
fails when a slice of array is part of an exported struct.
This bug could be related to #2323, #2303 too.
To Reproduce
-
wails init -n test-bug
-
cd test-bug
-
go get github.com/google/uuid
- Add the following lines to
app.go
and add"github.com/google/uuid"
to the imports
/* Copy the following code to your app.go file */
/* Add "github.com/google/uuid" to the imports */
type Works struct {
Bytes [1]byte `json:"bytes" validate:""`
Strings [1]string `json:"strings" validate:""`
UUID uuid.UUID `json:"uuid" validate:""`
}
type DoesNotWork struct {
Bytes [][1]byte `json:"bytes" validate:""`
Strings [][1]string `json:"strings" validate:""`
UUIDs []uuid.UUID `json:"uuids" validate:""`
}
// modules are generated
func (a *App) Works() Works {
return Works{}
}
// modules are not generated
func (a *App) DoesNotWork() DoesNotWork {
return DoesNotWork{}
}
-
go mod tidy
-
wails generate module
The following are obtained by having only one of DoesNotWork
struct fields at the time.
DoesNotWork.Bytes
2024/04/28 14:15:04 Error: cannot find type for array (bytes/)
DoesNotWork.Strings
2024/04/28 14:15:46 Error: cannot find type for array (strings/)
DoesNotWork.UUIDs
2024/04/28 14:16:21 Error: cannot find type for array (uuids/UUID)
Expected behaviour
modules are generated
Screenshots
No response
Attempted Fixes
No response
System Details
Wails Doctor
# Wails
Version | v2.8.1
# System
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| OS | MacOS |
| Version | 14.4.1 |
| ID | 23E224 |
| Go Version | go1.22.0 |
| Platform | darwin |
| Architecture | arm64 |
| CPU | Apple M2 Max |
| GPU | Chipset Model: Apple M2 Max Type: GPU Bus: Built-In Total Number of Cores: 30 Vendor: Apple (0x106b) Metal Support: Metal 3 |
| Memory | 32GB |
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
# Dependencies
┌───────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status | Version |
| Xcode command line tools | N/A | Installed | 2406 |
| Nodejs | N/A | Installed | 21.6.1 |
| npm | N/A | Installed | 10.2.4 |
| *Xcode | N/A | Installed | 15.3 (15E204a) |
| *upx | N/A | Available | |
| *nsis | N/A | Available | |
└─────────────────────── * - Optional Dependency ───────────────────────┘
# Diagnosis
Optional package(s) installation details:
- upx : Available at https://upx.github.io/
- nsis : More info at https://wails.io/docs/guides/windows-installer/
SUCCESS Your system is ready for Wails development!
♥ If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
Additional context
Discovered while migrating UUIDs in a personal project from string to uuid.UUID.