Go is not suitable for desktop GUI apps

I’ve started playing around with Go to list files and do some file actions. It worked great; the code was done quickly, but it only had a console output. That’s when I started looking at GUI toolkits to create a file manager-like UI.

I checked what’s available and was surprised how many libraries are out there. But the sad truth is: most of them are outdated and not in active development. Sure, I can understand that: why would anybody keep working on something as complex as a GUI toolkit in their free time? It’s not an easy task, especially when there are users with issues.

I tried Gio UI, Fyne, and some others. Most of the active ones are clearly not designed with classic desktop apps in mind. The last one I tried was Fyne, and it worked after some preparations. The issues were that it was slow to compile, needed a C compiler, and looked terrible. I was interested in something like a table and, although there is a table element, it looked more like aligned divs in a browser.

I came to the conclusion that Go is not the right choice for something like this. But what else could be a better solution?

I usually like Java, since it brings almost everything one can wish for and has a clear syntax—I am looking at you, Rust, with your ugly and unclear syntax. But a file manager should be fast, both in startup and in usage. Java is neither of them.

I used to develop stuff with Qt, but since Qt6 and their licensing disaster, it became unusable. I tried to install it and develop an example app a few months ago, but it was just not working right.

So I was wondering if I should just use WinAPI since I mainly use Windows. That would be possible, but WinAPI usually does not look as good as other frameworks. So I decided to give GTK a try.

Setting it up on Windows was a bit annoying since I had to install MSYS2 with some additional dependencies using its ugly terminal. I don’t like having something like a second system just for that, but using MSYS2 is the recommended way to compile GTK and such.

After a few hours of head banging, it worked. At least, mostly. GTK4 does not really work; it ignores themes and settings and has a thick and ugly black border around the windows for no obvious reason. I have not found the issue yet. But after switching to GTK3, it all worked.

I was able to write relatively simple C/C++ code, set up Meson in MSYS2, find out how to create a GitHub Actions pipeline with MSYS2, create a nice-looking table, query the filesystem with C++17’s filesystem API, and set up Cppcheck.

So far, it’s an interesting journey, although using C# would probably have been much easier. But I’ll keep working with C++ and trying out new features.

How to inspect RPM packages

While working with RPM packages I had to compare the ones I created with old ones to check if my pipeline produces the same output. I found a few command that helped me to do that.

To list the contents and their timestamps, you can use: rpm -qlpv package.rpm

To extract all contents you can use: rpm2cpio package.rpm | cpio -idmv -D extract_folder

To get the scripts use: rpm -qp --scripts package.rpm > package.spec

Kill processes on Windows via Command Line

Since working with Java, sometimes my services crash and the IDE does not recognize it. To kill the remaining Java processes, I use:

wmic process where "commandline like '%%java%%'" delete

That’s it. Interestingly, it does not kill IntelliJ IDEA, only the services. I guess, IntelliJ uses a different JVM name.

Print runtime dependencies in Golang

Getting a list of dependencies in Go is easy, but third-party libs have their dependencies, and it might not be obvious which ones get into the binary.

Go does provide a way by using runtmime.debug.ReadBuildInfo().Deps. Just add this to your application and it will print all dependencies:

buildInfo, ok := debug.ReadBuildInfo()
if !ok {
  panic("Can't read BuildInfo")
}
fmt.Println("Dependencies:")
for _, dep := range buildInfo.Deps {
  fmt.Printf("  %s %s\n", dep.Path, dep.Version)
}

This is not my code, I found it on StackOverflow: https://stackoverflow.com/a/59276408/12550134

Thanks to Mark A for sharing it.