# Golang<no value>

// <!-- Required for asciidoctor -->
:toc:
// Set toclevels to be at least your hugo [markup.tableOfContents.endLevel] config key
:toclevels: 4

[cols="1^,1^,1^",options=header]
|===
| source | condition | target
| &#10004; | &#10004; | &#10007;
|===

== 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 link:/docs/plugins/resource/gomod/[`golang/gomod`], link:/docs/plugins/resource/dockerfile/[`dockerfile`], or link:/docs/plugins/resource/file/[`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

{{< resourceparameters "sources" "golang" >}}

`version` is condition-only. For related resources see link:/docs/plugins/resource/gomodule/[`golang/module`], which looks up a module version, and link:/docs/plugins/resource/gomod/[`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:

[source,yaml]
----
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

[source,yaml]
----
# updatecli.yaml
{{<include "assets/code_example/docs/plugins/resources/golang/language/updatecli.d/default.yaml">}}
----

== Links

* link:https://go.dev/dl/[Go releases]
* link:/docs/core/versionfilter/["Version Filtering" page]
