Golang
| source | condition | target |
|---|---|---|
✔ | ✔ | ✗ |
Description
The golang resource returns a released version of the Go language itself - not of a module. It is the resource to use for bumping the toolchain version in a Dockerfile, a CI workflow, or a go.mod.
- source
Returns the Go version matching
versionfilter.- condition
Checks that
versionis a released Go version.- target
Not supported - a target fails with
Target not supported for the plugin Go. To write the version into a file, pair this source withgolang/gomod,dockerfile, orfile.
Note | An scm attached to a condition is ignored - the lookup is remote. Unlike most plugins this is logged at debug level only, so nothing appears in a normal run. |
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| age | object | age defines the minimum or maximum age of a release to be considered valid. It accepts a duration string (e.g., “24h”, “7d”). Compatible:
Remarks: If age is specified, the Updatecli retrieves the release date of each Golang version from a git repository. This has significant performance implications, as it requires fetching git tags and their associated commit dates. Use wisely. | |
| maximum | string | Maximum defines the maximum age of a release to be considered valid. It accepts a duration string (e.g., “24h”, “7d”, “3w”, “1y”). Accepted time units are “h” for hours, “d” for days, “w” for weeks, “mo” for months, and “y” for years. If no unit is provided, hours are assumed. | |
| minimum | string | Minimum defines the minimum age of a release to be considered valid. It accepts a duration string (e.g., “24h”, “7d”, “3w”, “1y”). Accepted time units are “h” for hours, “d” for days, “w” for weeks, “mo” for months, and “y” for years. If no unit is provided, hours are assumed. | |
| version | string | Version defines a specific golang version Compatible:
| |
| versionfilter | object | versionfilter provides parameters to specify version pattern and its type like regex, semver, or just latest. Compatible:
| |
| kind | string | specifies the version kind such as semver, regex, or latest | |
| pattern | string | specifies the version pattern according the version kind for semver, it is a semver constraint for regex, it is a regex pattern for time, it is a date format | |
| regex | string | specifies the regex pattern, used for regex/semver and regex/time. Output of the first capture group will be used. | |
| replaceall | object | replaceAll applies a regex replacement to version strings before filtering. This is useful for transforming versions (e.g., curl-8_15_0 to curl-8.15.0) before regex extraction. | |
| strict | boolean | strict enforce strict versioning rule. Only used for semantic versioning at this time |
version is condition-only. For related resources see golang/module, which looks up a module version, and golang/gomod, which reads and writes a go.mod file.
Filtering by release age
age restricts which releases count as valid, which is how you avoid adopting a version the day it ships:
spec:
age:
minimum: "2w" # only versions released at least two weeks agominimum and maximum accept h (hours), d (days), w (weeks), mo (months) and y (years). A bare number means hours. An unparsable value fails with invalid MinimumReleaseAge "<value>".
Warning | Setting |
Example
# updatecli.yaml
name: "Golang example"
sources:
default:
name: Get Golang version
kind: golang
spec:
versionfilter:
kind: semver
pattern: "1.15.x"
conditions:
# The version to check is inherited from source "default"
default:
name: Checks that golang version from source default exists
kind: golang
sourceid: default
nosourceinput:
disablesourceinput: true
name: Checks that golang version 1.20.1 exists
kind: golang
spec:
version: "1.20.1"