This article explains the process Tyk uses to determine the specific version of Go for compiling its products. While the
The Process
The versioning mechanism is a two-step process that separates the base version requirement from the final build environment.
1. Base Version in
The
go.mod file in a component's repository specifies a major and minor version (e.g., 1.24), the final binary is compiled using the latest available patch release for that version (e.g., 1.24.13). This ensures that all builds include the most recent security patches and bug fixes from the Go toolchain.The Process
The versioning mechanism is a two-step process that separates the base version requirement from the final build environment.
1. Base Version in
go.modThe
go.mod file in each Tyk component repository (like Tyk Gateway) defines the minimum required Go version for that module. For example, you will see a line like this:go 1.24
This declaration ensures that the code is compatible with the Go 1.24 release line and is the source of truth for local development and Go module-aware tools.
2. Latest Patch Version in the Build Environment
Tyk uses a centralized repository,
TykTechnologies/golang-cross (https://github.com/TykTechnologies/golang-cross) , to create the official Docker images that serve as our build environment. The process for selecting the latest patch version happens here:1. Build Image Creation: When a new build image is created for a specific Go line (e.g., 1.24), a script within the
golang-cross repository is executed.2. Fetching the Latest Version: This script queries the official Go download API to find the latest stable patch release available for the specified major/minor version.
3. Installation: The script then downloads and installs this specific patch version (e.g.,
1.24.13) into the Docker image.When our CI/CD pipeline builds a Tyk component, it uses this pre-built
golang-cross image. As a result, the Go toolchain inside the container has the latest patch version, which is then used to compile the final binary.This approach allows Tyk to set a stable, baseline Go version in the product's
go.mod file while ensuring that all official builds are automatically compiled with the latest security patches and bug fixes from the Go team. This provides a secure and stable build process without requiring constant manual updates to every repository for each patch release
Comments
0 comments
Please sign in to leave a comment.