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. compatible:
remark:
example: | |
| maximum | string | “maximum” defines the maximum age a release may have to be considered. remark:
example:
| |
| minimum | string | “minimum” defines the minimum age a release must have to be considered. remark:
example:
| |
| version | string | “version” defines the Go version to check. compatible:
default: the output of the associated source. example:
| |
| versionfilter | object | “versionfilter” defines the version pattern and its type, such as regex, semver or latest. compatible:
default: kind: semver pattern: “*” example: | |
| kind | string | “kind” defines the versioning scheme used to select a version. default: latest remark:
example:
| |
| pattern | string | “pattern” defines the version pattern, according to “kind”. default:
remark:
example:
| |
| regex | string | “regex” defines the regular expression extracting the version from each entry. remark:
example:
| |
| replaceall | object | “replaceall” applies a regular expression replacement to each version before filtering. remark:
example: turns “curl-8_15_0” into “curl-8.15.0”. | |
| strict | boolean | “strict” enforces strict semantic versioning rules when parsing versions. default: false remark:
|
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"