Go Tidbit: Update Checker with GitHub Releases
June 24, 2023
#100DaysToOffload
#Go
#Tidbit
After building Printd, Toph’s print daemon, it became necessary to ensure that contest organizers were using the latest version of the software. Since Printd is open-source we host both the code and the release artifacts on GitHub.
The following function uses the Go client library for GitHub to check the latest release and compare the tag with the current version.
|
|
Since the API is accessible publicly you do not need to authenticate the GitHub API requests.
The current version is stored in the buildTag
variable. You can easily set this variable at build time using ldflags
as shown in Go Tidbit: Setting Variables in Go During Build.
This post is 22nd of my #100DaysToOffload challenge. Want to get involved? Find out more at 100daystooffload.com.
comments powered by Disqus
Similar Blog Posts
March 6, 2023
#100DaysToOffload
#Go
#Tidbit
February 9, 2023
#100DaysToOffload
#Go
#Tidbit