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.

compatible:

  • source
  • condition

remark:

  • when set, Updatecli reads the release date of each Go version from the git repository https://github.com/golang/go.git, using the commit date of each tag.
  • fetching the git tags and their commit dates is slow, so use it with care.

example:

  age:
    minimum: 7d
    maximumstring

“maximum” defines the maximum age a release may have to be considered.

remark:

  • accepted units are “d” for days, “w” for weeks, “mo” for months and “y” for years, plus the Go duration units such as “h”, “m” and “s”.
  • a unit is required.
  • a month counts as 1/12 of a year and a year as 365 days.

example:

  • maximum: 6mo
  • maximum: 1y
    minimumstring

“minimum” defines the minimum age a release must have to be considered.

remark:

  • accepted units are “d” for days, “w” for weeks, “mo” for months and “y” for years, plus the Go duration units such as “h”, “m” and “s”.
  • a unit is required.
  • a month counts as 1/12 of a year and a year as 365 days.

example:

  • minimum: 24h
  • minimum: 7d
  • minimum: 3w
versionstring

“version” defines the Go version to check.

compatible:

  • condition

default: the output of the associated source.

example:

  • version: 1.23.0
versionfilterobject

“versionfilter” defines the version pattern and its type, such as regex, semver or latest.

compatible:

  • source

default: kind: semver pattern: “*”

example:

  versionfilter:
    kind: semver
    pattern: "~1.23"
    kindstring

“kind” defines the versioning scheme used to select a version.

default: latest

remark:

  • accepted values are “latest”, “semver”, “regex”, “regex/semver”, “time”, “regex/time”, “lex” and “pep440”.
  • “latest” returns the last version of the list.
  • “lex” sorts the versions lexicographically and returns the last one.
  • “pep440” follows https://peps.python.org/pep-0440/

example:

  • kind: semver
    patternstring

“pattern” defines the version pattern, according to “kind”.

default:

  • latest: “latest”
  • semver and pep440: “*”
  • regex: “.*”
  • time and regex/time: “2006-01-02”

remark:

  • for “latest”, “latest” returns the last version, any other value must match a version exactly.
  • for “semver” and “regex/semver”, it is a semantic versioning constraint.
  • for “pep440”, it is a pep440 version specifier.
  • for “regex”, it is a regular expression.
  • for “time” and “regex/time”, it is a Go date layout.
  • ignored by “lex”.

example:

  • pattern: ~1.2
  • pattern: “>=1.0.0 <2.0.0”
  • pattern: ^v\d+.\d+.\d+$
    regexstring

“regex” defines the regular expression extracting the version from each entry.

remark:

  • only used by the kinds “regex/semver” and “regex/time”.
  • the value of the first capture group is used as the version.

example:

  • regex: ^v(\d+.\d+.\d+)$
    replaceallobject

“replaceall” applies a regular expression replacement to each version before filtering.

remark:

  • only used by the kinds “regex”, “regex/semver” and “regex/time”.
  • the replacement runs before “pattern” or “regex” is evaluated.

example:

replaceall:
  pattern: "_"
  replacement: "."

turns “curl-8_15_0” into “curl-8.15.0”.

    strictboolean

“strict” enforces strict semantic versioning rules when parsing versions.

default: false

remark:

  • only used by the kinds “semver” and “regex/semver”.

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"