
Golang is a statically typed, compiled language that's designed to be fast and efficient.
The Go change log provides a comprehensive record of changes made to the Go language and standard library.
Each version of Go has its own change log, which is published on the official Go website.
The change log for Go 1.17, for example, lists over 1,500 changes, including improvements to the standard library and language itself.
Worth a look: Go vs Golang
Installation and Setup
To get started with a GoLang change log, you'll first need to install git-chglog. Please install git-chglog in a way that matches your environment.
For this, you have options concerning the acquisition and sort of commits.
Understanding Chglog
A changelog is essentially a reverse-chronological list of versions and their changes.
Each version can have its own direct list of uncategorized changes, and can contain a set of subsections. Subsections are a means of categorizing sets of changes based on component or type of change.
A basic changelog might look something like a list of versions with their corresponding changes, where each change consists of a summary and a reference – either a pull request or issue number, or a mention to the contributing user.
Why
Writing good changelogs is a challenge. Writing them by hand inevitably leads to people forgetting to include things in the changelog.
Changelogs are an important interface for helping users be aware of development efforts and behavioral changes in software. Basing changelog entries on commit messages conflates two audiences; commit messages are for developers and maintainers, and should be directed towards them.
Writing changelogs in PR bodies is quick and easy, but it has its drawbacks. PR bodies aren't stored in the repository itself, making it harder to keep changelogs with the code they describe.
Here are some common issues with changelog generation:
- Forgetting to include things in the changelog
- Conflating two audiences in changelog entries
- PR bodies not being stored in the repository
Changelogs are a crucial part of software development, and making them easy to generate correctly is a top priority.
Overview
A changelog is essentially a reverse-chronological list of versions and their changes. The structure is quite straightforward, making it easy to follow.
Each version can have its own list of uncategorized changes, which can be broken down into subcategories if needed. This helps to keep the changelog organized.
A basic changelog is typically made up of a summary and a reference, such as a pull request or issue number, or a mention of the contributing user.
History Filename
Understanding Chglog requires a solid grasp of its core components, and one crucial aspect is the History Filename. It discovers the correct filename for your history file based on files in the current working directory.
Chglog's HistoryFilename iterates through the files in your current directory. It looks for a file with some case-insensitive form of History.markdown or Changelog.markdown with any series of supported markdown file extensions.
This means you can have files named history.markdown, History.Markdown, or even changelog.md, and Chglog will still be able to find them.
Working with Chglog
Working with Chglog is a straightforward process that leverages the power of Go modules.
Chglog uses a configuration file named `chglog.yml` to manage its behavior, which allows you to customize its features and settings.
You can use the `chglog init` command to generate a basic configuration file, making it easier to get started with Chglog.
Chglog supports multiple output formats, including Markdown and HTML, which is useful for different use cases and documentation styles.
You can also use Chglog to generate a changelog for a specific commit range, making it easy to track changes over time.
Git Chglog
Git Chglog is a fantastic tool for generating CHANGELOGs. It's implemented in Go (Golang) and can be used anywhere, anytime.
You can check if the git-chglog command is in your $PATH by running a command in your terminal.
One of the most useful features of git-chglog is its ability to display available diffs. These diffs show you the changes made between different versions of a project.
Here are some examples of diffs that git-chglog can display:
You can see that these diffs show the changes made between different versions of a project, including the size of each diff. This can be really helpful for tracking changes and understanding what's new in a project.
New From File
Working with Chglog can be a breeze if you know the right tools. The NewChangelogFromReader function builds a changelog from the contents read in through the reader it's passed. This is super helpful when you have a lot of data to process.
You can also use the NewChangelogFromFile function to build a changelog from a file at the provided filename. This is a great option when you have a changelog stored in a file and want to easily import it into Chglog.
The NewChangelogFromFile function is specifically designed for this purpose, making it a convenient choice for many users.
Check this out: Azure Function Logging
AddLineToVersion
AddLineToVersion is a crucial function in Chglog that allows you to add a ChangeLine to a specific version's direct history.
This function is particularly useful when a change doesn't warrant a subsection, or it's simply not suitable to add it to a subsection.
You can use AddLineToVersion to add a ChangeLine to a version's history, as long as it's not already included in a subsection.
For instance, you might use this function to add a minor bug fix to a version's history, without creating a new subsection for it.
AddLineToVersion is a flexible tool that gives you the freedom to manage your changelog in a way that makes sense for your project.
You might enjoy: Golang Version Manager
GetSubsectionOrCreate
GetSubsectionOrCreate is a powerful function that allows you to fetch a Subsection struct from a Changelog. It matches the versionNum and subsectionName, and if no match is found, it creates a new Subsection and saves it to the Changelog.
The function is a variation of GetSubsection, which also fetches a Subsection struct, but returns nil if no match is found. GetSubsectionOrCreate, on the other hand, creates a new Subsection if no match is found, making it a convenient option when working with Changelog data.
You can use GetSubsectionOrCreate to populate your Changelog with missing Subsection data, which can be especially useful when working with large datasets. By creating a new Subsection, you can ensure that your Changelog is complete and up-to-date.
Related reading: Newrelic Logging
File Formatting
The files in your directory should have a specific formatting to describe the changes that will be used to generate the changelog.
The type of release note entry is usually "bug", "enhancement", etc., but you can enter whatever you want and it will be available when generating the changelog.
Each entry should have a body that describes the changes made, and this is used as free-text input.
If a PR has multiple changelog entries associated with it, you should use multiple blocks to list them out.
Silent Failure Due to Missing Entry

If a change forgets to include a changelog entry at all, the tool will ignore it completely.
This can be frustrating, especially if you're relying on the tool to help you manage your changes.
PR-based tools can shout loudly that a PR did not include a change, but this system does not have that capability without expecting every commit to have a changelog entry associated with it.
Automation is the key to preventing changes without changelog entries before they're merged, to ensure every change gets an entry.
This approach helps catch missing changelog entries early on, saving you time and effort in the long run.
Type Changelog
Working with Chglog is all about understanding how to structure and build a changelog that accurately reflects the changes made to your project.
The Changelog type represents a changelog in its entirety, containing all the versions that are tracked in the changelog.
For supported formats, see the documentation for Version, which will give you a clear idea of how to format your changelog correctly.
In Chglog, a changelog entry should have a specific formatting, with TYPE being the type of release note entry, such as "bug", "enhancement", etc., and ENTRY being the body of the changelog entry.
This means you can use whatever types and entries you need, and they will be available to you when generating the changelog.
Service
To create a service with GoFr, you'll need to design it to provide the log level to your application. We'll be using MySQL as our database, which requires adding specific configs to the .env file in the configs directory.
GoFr requires a response from the URL in a specific format with two mandatory fields. To run the MySQL docker container, you'll need to execute a particular command.
The main.go file will contain migrations to create the table, and we'll use the AddRESTHandler feature to register the route. After running the Log Service, you'll see specific logs.
To update the log level, send a request to the designated URL with a specific body.
Broaden your view: Golang Url
Chglog Features and Options
Chglog is a simple and easy-to-use tool for generating change logs in Go.
It supports multiple formats, including Markdown, JSON, and plain text.
Chglog can also be used with GitHub, GitLab, and Bitbucket to automatically generate change logs from your commit history.
One of the key features of chglog is its ability to handle complex commit histories, including merges and reverts.
It can also be used to generate change logs for specific commits or ranges of commits.
This makes it a very flexible tool for developers who need to generate change logs for their projects.
Chglog can be installed using Go get, and it requires no additional dependencies.
It is also very easy to use, with a simple command-line interface that makes it easy to generate change logs.
Related reading: Golang Go
Featured Images: pexels.com


