Golang module
| source | condition | target |
|---|---|---|
✔ | ✔ | ✗ |
Description
The golang/module resource queries a Go module proxy for the published versions of a module.
- source
Returns the version matching
versionfilter.- condition
Checks that
versionis published for the module.- target
Not supported - a target fails with
Target not supported for the plugin GO module. To write the version into ago.mod, usegolang/gomod.
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:
| |
| 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. | |
| module | string | module specifies the name of the Golang module Compatible:
| |
| proxy | string | Proxy allows to override GO proxy similarly to GOPROXY environment variable. Proxy may have the schemes https, http. file is not supported at this time. If a URL has no scheme, https is assumed Compatible:
| |
| version | string | version defines a specific package version to check 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 |
moduleMandatory - the full module path, e.g.
github.com/updatecli/updatecli.proxyOverrides the proxy, the same way
GOPROXYdoes.httpsandhttpschemes are accepted, and a URL without a scheme is assumed to behttps.file://proxies are not supported.versionCondition only.
Pseudo-versions (the v0.0.0-20230101120000-abcdef123456 form Go generates for untagged commits) are understood.
Filtering by release age
age restricts which releases count as valid, which is the usual way to let a release settle before adopting it:
spec:
module: github.com/sirupsen/logrus
age:
minimum: "7d"minimum and maximum accept h, d, w, mo and y; a bare number means hours. An unparsable value fails with invalid MinimumReleaseAge "<value>".
Warning |
Versions whose date cannot be fetched or parsed are skipped silently - visible only with |
Example
# updatecli.yaml
name: "Golang module example"
sources:
default:
kind: golang/module
name: Get the latest Golang module version for github.com/Masterminds/semver/v3
spec:
module: "github.com/Masterminds/semver/v3"
semver:
kind: golang/module
name: Get Golang module version for github.com/Masterminds/semver/v3 matching version 3.2
spec:
module: "github.com/Masterminds/semver/v3"
versionfilter:
kind: semver
pattern: "3.2"
conditions:
default:
# The version is set by the sourceid "default"
kind: golang/module
name: Checks if version v3.2.0 exists for Golang module github.com/Masterminds/semver/v3
sourceid: default
spec:
module: "github.com/Masterminds/semver/v3"
noSourceInput:
disablesourceinput: true
kind: golang/module
name: Checks if version v3.2.0 exists for Golang module github.com/Masterminds/semver/v3
spec:
module: "github.com/Masterminds/semver/v3"
version: "v3.2.0"