Featured image of post Watch Go 0.2.0

Watch Go 0.2.0

New version released!

Download links

Summary

This version comes with a slew of changes including an actual GUI implementation. Gone are the days of printing in a loop and cluttering up your terminal history. The time of terminal GUI has come.

Much the same as before, we collect metrics/statistics on the run: successes, failures, start time, stop time, total time. But new to this release is printing those on the simple grid display we have created.

The Details

With the learning curve of Go being a little different for me, a Java and JavaScript focused engineer, this update came with a good amount of learning.

While Java has strong types and interfaces for inheritance, it’s written much differently. JavaScript, being what runs the web today and used in 90% or more of the projects I work on, even with typing enabled is still far from the low level nature of Go.

This version of Watch Go includes a new package, tview. Tview allows us to draw a GUI inside of the terminal and use it to sort and organize data in a whole new way. Tools like k9s take advantage of tview with the ability to display menus, follow logs, create interactive shell sessions, all from within one terminal screen.

I won’t lie, I spent a long time trying to figure out why I couldn’t pass some values between functions in Go. There’s a lot to learn here, like why some things can pass via go func and some things can’t. But I got what I needed and will hopefully get a chance to improve the code quality over time.

Also taking much time and frustration was the publishing process. GitLab pipelines are awesome and powerful. But publishing these files via a simple cURL to the API just didn’t work right. If you look at the 0.2.0 tag, it actually “failed” the pipeline and the next commit to the repository makes it so curl failing won’t fail the pipeline. That’s not ideal but it will work for now.

All the Builds

A new feature for me, building cross platform and cross architecture.

Java and JavaScript are portable. That’s true. But nothing quite like Go. I can build a jar and pass it around to other systems as long as they have an updated version of the Java JRE installed. JavaScript, much the same with NodeJS or a browser engine.

Go gives me the ability to build a native executable though. This is something difficult to do in both Java and JavaScript. JS can do it but you need to have the Node executable lying around and it doesn’t allow you to do it across platform.

The closest I have experienced to this is with Python. PyInstaller gave me the ability to compile code for Linux from my workstation or a GitLab pipeline. But using Wine to compile it for Windows is a nightmare.

Once again, Go just works with this. As of 0.2.0, we now build for Linux - both amd64 and arm64, MacOS - arm64, and Windows - amd64. All of these builds are available from the pipeline artifacts as well as the package registry for the tagged version.

While I cannot test all of the builds - hopefully that is something Google worked out with the build tooling - I do hope to use it across environments where possible. I already use it on my Windows PC at work and my Linux PC at home.

As always, I am trying to document as I go, but it’s not perfect. Forgive the lack of clear and concise documentation in this repo, but please accept the Changelog for details.

"A generous person will prosper; whoever refreshes others will be refreshed." - Proverbs 11:25
Built with Hugo
Theme Stack designed by Jimmy