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

Wails build creating invalid folders based on embed file selections. Then failing. #3436

Closed
precisionpete opened this issue Apr 26, 2024 · 7 comments · Fixed by #3445
Closed
Labels
Bug Something isn't working

Comments

@precisionpete
Copy link

precisionpete commented Apr 26, 2024

Description

I have a strange problem where the "wails build" process is creating folders with illegal names based on files I am embedding. The embed commands are not part of the wails app but are in another package in my project.

handlers/render.go contains:
//go:embed assets/*
var assetsFs embed.FS
//go:embed *.gohtml
//go:embed layouts/*.gohtml
var templateFs embed.FS

Wails build creates folders with those name 'assets/*', '*.gohtml', etc. with a file gitkeep in them. It's either wails or some component used by wails.

Then, it fails to compile due to those existing. It is definitely wails build that is creating them. I delete them and they show up again.

$ find .|grep '*'
./cmd/prog/package/handlers/*.gohtml
./cmd/prog/package/handlers/*.gohtml/gitkeep
./cmd/prog/package/handlers/layouts/*.gohtml
./cmd/prog/package/handlers/layouts/*.gohtml/gitkeep
./cmd/prog/package/handlers/assets/*
./cmd/prog/package/handlers/assets/*/gitkeep

To Reproduce

Just running wails build in my project root. It worked fine for months and just started.

$ wails build
Wails CLI v2.8.1
# Build Options
Platform(s)        | linux/amd64                                               
Compiler           | /usr/local/go/bin/go                                      
Skip Bindings      | false                                                     
Build Mode         | production                                                
Devtools           | false                                                     
Frontend Directory | /home/pcarroll/Development/Golang/netrinos-client/frontend
Obfuscated         | false                                                     
Skip Frontend      | false                                                     
Compress           | false                                                     
Package            | true                                                      
Clean Bin Dir      | false                                                     
LDFlags            |                                                           
Tags               | []                                                        
Race Detector      | false                                                     

# Building target: linux/amd64
  • Generating bindings:   ERROR   
          cmd/prog/package/handlers/render.go:27:12: pattern *.gohtml: cannot embed directory *.gohtml: invalid name *.gohtml
          exit status 1
  ERROR   
          cmd/prog/edgenode/handlers/render.go:27:12: pattern *.gohtml: cannot embed directory *.gohtml: invalid name *.gohtml          
          exit status 1

Expected behaviour

It just compiles on Windows and used to on Linux

Screenshots

No response

Attempted Fixes

I delete the folders, delete the build folder. It all comes back.

System Details

On Linux 22.04 amd64 with Wails 2.8.1 and Go 1.22.2 it fails. Same on Windows 11 works fine as before.


$ wails doctor

                                
          Wails Doctor          
                                

                                                                                                                           
# Wails
Version         | v2.8.1
Package Manager | apt   

# System
┌───────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Linux Mint                                                             |
| Version      | 21.3                                                                   |
| ID           | linuxmint                                                              |
| Go Version   | go1.22.2                                                               |
| Platform     | linux                                                                  |
| Architecture | amd64                                                                  |
| CPU          | Intel(R) Core(TM) i7-8700T CPU @ 2.40GHz                               |
| GPU          | CoffeeLake-S GT2 [UHD Graphics 630] (Intel Corporation) - Driver: i915 |
| Memory       | 66GB                                                                   |
└───────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Available | 24.0.5-0ubuntu1~22.04.1 |
| gcc        | build-essential       | Installed | 12.9ubuntu3             |
| libgtk-3   | libgtk-3-dev          | Installed | 3.24.33-1ubuntu2        |
| libwebkit  | libwebkit2gtk-4.0-dev | Installed | 2.44.0-0ubuntu0.22.04.1 |
| npm        | npm                   | Installed | 10.2.4                  |
| *nsis      | nsis                  | Installed | v3.08-2                 |
| pkg-config | pkg-config            | Installed | 0.29.2-1ubuntu3         |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

# Diagnosis
Optional package(s) installation details: 
  - docker: sudo apt install docker.io

 SUCCESS  Your system is ready for Wails development!

Additional context

Please give me some hints on how to debug this...

@precisionpete precisionpete added the Bug Something isn't working label Apr 26, 2024
@TwoNull
Copy link
Contributor

TwoNull commented Apr 27, 2024

It seems this is an issue with how Wails generates a list of embedded files, the pattern matching syntax your external packages use is perfectly valid and it should match the associated files instead of looking for a directory with asterisks and whatnot.

@leaanthony
Copy link
Member

@precisionpete As we don't have your project to reproduce, could you please do a git bisect to determine which commit started doing this. AFAIK there has been no code updates to creating directories in a long time so I'm curious.

@precisionpete
Copy link
Author

I don't use git on this one. Git is installed (thus the gitignore files). But I've not been committing things regularly.

I think what changed was I combined the handlers and templates into the same folder. I was spending too much time going back and forth between two folders. This required adding the *.gohtml selection. I was working on the Windows version of the app at the time and all was well. When I went back to Linux, it started happening. I did not try it on macos.

To continue to get work done, I separated the handlers and templates folders again, and it all worked. It also works on macros.

So, maybe this bug has been there for a while? It would be interesting to know if it's wails or vite doing it. I'm using wails with sveltekit.

The handlers are not used in the wails part of the app. I have another daemon that uses them. And even though the embeds are not "within" the wails app's context, they are in a package under the overall project.

My application is a daemon that runs as root and a Wails front end that sits under a systray icon. Wails does not interact with http.

Personally, I suspect some of the external tools wails is using in its build.

@leaanthony
Copy link
Member

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 👍

@leaanthony
Copy link
Member

@precisionpete ☝️

@precisionpete
Copy link
Author

Sorry, I have been nose down trying to meet a deadline. I will have to come back to it if its okay? A few days,

@precisionpete
Copy link
Author

precisionpete commented May 1, 2024

That seems to have fixed it on Linux.

It's also fixed on macOS.

I never had the problem on Windows...

Thanks for the fix. Great product!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants