I love GO but maybe not the documentation. The struggle is REAL!!!
This week in the topic of open source, we get to learn a very good approach for identifying where a bug started to happen using git bisect
. I really enjoyed the walkthrough reading provided by professor Dave. I felt like I followed a story and I did not want to miss any information. The approach which he called “Good-First-Experience” is really good approach to apply in real world project when the size of the projects is large. I look forward to use it for future bug fixings or feature enhancements.
Also, the lab for this week requires us to release our link checker app using a well established package manager of our chosen language. I have to say that the whole process could have been much quicker if Go’s documentations are more reliable. It took me a long time to find out the small things to continue with the releasing process. I used pkg.go.dev
to release my app. Apparently this website tracks all GO module that is hosted on Github. To get access to your module, you only need to enter your package name in the form github.com/your-github-nam/your-module-name
and the website will extract information including versions and source files. That sounds great right? I did not have to write any code or using any tool to release it, pkg.go.dev
would take the Github release with semantic tag (i.e: v1.0.0
) (Yes, it needs to be semantic or else it won’t be recognized). That was my first problem because I initially released my app with the tag having no v
prefix.
Then I came across another problem, the version was not updated. I was wondering what I did wrongly. It took me almost three hours to find out that version is not updated until someone request to pull the latest version. Apparently not many people have asked about this issue. It could be because GO is not a popular language just yet. I found one github discussion that helped me to fix my issue. However, even when I followed what have been discussed in the issue, I could not make it work. Eventually, I figured it out by going to https://godoc.org/ , then searched for my module the same way I did with pkg.go.dev
and clicked Refresh Now
button a few time. Then I went back to my module on pkg.go.dev
and everything was updated. Phew!!! What a struggle!!! Why Google? WHY? It should have been straightforward, not confusing. I am glad that I figured it out. I decided to share my experience with other students who use GO for their projects in case they need some guidance.
The last thing I did was to implement automatic release through Github Actions. I used a module called goreleaser. The setup is easy to follow and they have very good documentations (I am having a dig at Google). I created a .goreleaser.yml
file containing the basic configs to release my module. I chose to release it with binary files for different platforms as well. You can see the detail of .goreleaser.yml
here. To trigger automatic releasing from Github actions, I need to add another file to my Github .workflow
called release_build.yml
so Github can do automatic release when I push a new tag to Github. You can find detail of release_build.yml
here. I did have a couple of failed release, one of them was because I forgot to set up a token to use in the release config file. Please see photo below:
Finally, I was able to create my v1.0.0 release. It was a good feeling that I have not only completed an application in a new language, but also tackled all areas of software development throughout the process. I have struggled finding solutions from GO’s documentations, but I have also learned a lot especially in the area of CI/CD.
The end of the semester is near and I am so ready to take a break. Technically, I won’t have a break because I will start working on new features for my coop placement right after I finish school. I am really looking forward to that and also OSD700. It’s going to be busy next four months, but I believe time will be well spent. You can find all of my work for the application here.
Thats it from me forks. Thank you for reading.
Tony Vu.