sourceconditiontarget

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 version is 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 with golang/gomod, dockerfile, or file.

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

NameTypeDescriptionRequired
ageobject

age defines the minimum or maximum age of a release to be considered valid. It accepts a duration string (e.g., “24h”, “7d”).

Compatible:

  • source
  • condition

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.

    maximumstringMaximum 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.
    minimumstringMinimum 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.
versionstring

Version defines a specific golang version

Compatible:

  • condition
versionfilterobject

versionfilter provides parameters to specify version pattern and its type like regex, semver, or just latest.

Compatible:

  • source
    kindstringspecifies the version kind such as semver, regex, or latest
    patternstringspecifies 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
    regexstringspecifies the regex pattern, used for regex/semver and regex/time. Output of the first capture group will be used.
    replaceallobjectreplaceAll 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.
    strictbooleanstrict 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 ago

minimum 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 age changes how the resource works. To learn a release date, Updatecli fetches the git tags of the Go repository and reads their commit dates - considerably slower than the plain version lookup. Use it where the delay is worth it, not by default.

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"