Commit Graph

50 Commits (6d261de6741d0de29f98dabf146ead3e510f8279)

Author SHA1 Message Date
George Adams 78af96c188 feat: add go-download-base-url input for custom Go distributions
Add support for downloading Go from custom sources such as Microsoft Go
(aka.ms). Users can specify a custom download base URL via the
`go-download-base-url` input or the `GO_DOWNLOAD_BASE_URL` environment
variable (input takes precedence).

When a custom URL is provided, the action skips the GitHub-hosted
manifest and attempts to resolve versions from the custom URL's JSON
listing. If the listing is unavailable (as with aka.ms redirect links),
it falls back to constructing the download URL directly from the
version, platform, and architecture.

Usage:
  - uses: actions/setup-go@v6
    with:
      go-version: '1.25'
      go-download-base-url: 'https://aka.ms/golang/release/latest'

Changes:
- action.yml: add go-download-base-url optional input
- installer.ts: add getInfoFromDirectDownload() for URL construction
  fallback, thread custom URL through getGo/getInfoFromDist/findMatch
- main.ts: read new input and GO_DOWNLOAD_BASE_URL env var
- setup-go.test.ts: add 12 unit tests for custom URL behavior
- microsoft-validation.yml: add E2E workflow testing Microsoft build of Go
  across ubuntu/windows/macos with versions 1.24 and 1.25
- README.md: document new input with Microsoft build of Go examples
2 months ago
Salman Chishti e093d1e9bb
Node 24 upgrade (#624)
* Node 24 upgrade

Doing an upgrade for node 24, node 24 is stricter with types so need to add a type for achitecture

* format

* package updates

* fix for check failures

* upgrade @types/node

* update package.json version

* check failure fix

* package-lock.json update

* update node24

* npm run format

* npm run format

* node update from the workflows

* Upgrade `actions/checkout` to v5 and `actions/setup-go` to v6 in README.md

---------

Co-authored-by: Aparna Jyothi <aparnajyothi-y@github.com>
Co-authored-by: Priya Gupta <147705955+priyagupta108@users.noreply.github.com>
8 months ago
Matthew Hughes 1d76b952eb
Improve toolchain handling (#460)
* Configure environment to avoid toolchain installs

Force `go` to always use the local toolchain (i.e. the one the one that
shipped with the go command being run) via setting the `GOTOOLCHAIN`
environment variable to `local`[1]:

> When GOTOOLCHAIN is set to local, the go command always runs the
bundled Go toolchain.

This is how things are setup in the official Docker images (e.g.[2], see
also the discussion around that change[3]). The motivation behind this
is to:

* Reduce duplicate work: if the `toolchain` version in `go.mod` was
  greated than the `go` version, the version from the `go` directive
  would be installed, then Go would detect the `toolchain` version and
  additionally install that
* Avoid Unexpected behaviour: if you specify this action runs with some Go
  version (e.g. `1.21.0`) but your go.mod contains a `toolchain` or `go`
  directive for a newer version (e.g. `1.22.0`) then, without any other
  configuration/environment setup, any go commands will be run using go
  `1.22.0`

This will be a **breaking change** for some workflows. Given a `go.mod`
like:

    module proj

    go 1.22.0

Then running any `go` command, e.g. `go mod tidy`, in an environment
where only go versions before `1.22.0` were installed would previously
trigger a toolchain download of Go `1.22.0` and that version being used
to execute the command. With this change the above would error out with
something like:

> go: go.mod requires go >= 1.22.0 (running go 1.21.7;
GOTOOLCHAIN=local)

[1] https://go.dev/doc/toolchain#select
[2] dae3405a32/Dockerfile-linux.template (L163)
[3] https://github.com/docker-library/golang/issues/472

* Prefer installing version from `toolchain` directive

Prefer this over the version from the `go` directive. Per the docs[1]

> The toolchain line declares a suggested toolchain to use with the
module or workspace

It seems reasonable to use this, since running this action in a
directory containing a `go.mod` (or `go.work`) suggests the user is
wishing to work _with the module or workspace_.

Link: https://go.dev/doc/toolchain#config [1]
Issue: https://github.com/actions/setup-go/issues/457

* squash! Configure environment to avoid toolchain installs

Only modify env if `GOTOOLCHAIN` is not set

* squash! Prefer installing version from `toolchain` directive

Avoid installing from `toolchain` if `GOTOOLCHAIN` is `local`, also
better regex for matching toolchain directive
8 months ago
Dmitry Shibanov 0c52d547c9
Update dependencies for node20 (#445) 2 years ago
Dmitry Shibanov fdc0d672a1
Add Go bin if go-version input is empty (#351) 3 years ago
Dmitry Shibanov ebfdf6ac95
add warning if go-version is empty (#350) 3 years ago
Sergey Dolin c51a720768
Enable caching by default with default input (#332) 3 years ago
Ivan 7406d654ad
Add and configure ESLint and update configuration for Prettier (#341)
* Turn on ESLint and update Prettier

* Update eslint config

* Update eslint config

* Update dependencies

* Update ESLint and Prettier configurations

* update package.json

* Update prettier command

* Update prettier config file

* Change CRLF to LF

* Update docs

* Update docs
3 years ago
Evgenii Korolevskii b27afcd9c2 format 3 years ago
Evgenii Korolevskii 65f50caf42 use actual version in key 3 years ago
Evgenii Korolevskii 89d7939d38 use real version instead of spec 3 years ago
Evgenii Korolevskii 2e7414f276 try get path 3 years ago
Evgenii Korolevskii de201a09c0 log version-spec 3 years ago
Milos Pantic 38dbe75f81
Add stable and oldstable aliases (#300) 3 years ago
Dmitry Shibanov 27b43e1b0d
Pass the token input through on GHES (#277) 4 years ago
n33pm c4a742cab1
fix(): cache resolve version input (#267) 4 years ago
Milos Pantic 268d8c0ca0
Add support for arm32 go arch (#253) 4 years ago
IvanZosimov b22fbbc292
Implementation of caching functionality for setup-go action (#228) 4 years ago
So Jomura 265edc1beb
Add go-version-file option (#62) 4 years ago
Brian Cristante 193b404f8a
Successfully set up (#231) 4 years ago
Vladimir Safonkin ad70bef2ef Fix condition for old go versions 4 years ago
Nick 4a4352b330
Add 'go-version' Output (#85)
* Add go-version to action outputs

This provides the semver version of Go that has been installed. This is useful
if only a major or minor version has been provided as the input go-version
value.

* Convert version extraction to a function

Simplify how the version is extracted and add a simple test at the same
time.

Co-authored-by: Peter Mescalchin <peter@magnetikonline.com>
Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com>

Co-authored-by: Peter Mescalchin <peter@magnetikonline.com>
Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com>
4 years ago
Fraser Waters 0b4fbc55f6 await io.mkdirP 4 years ago
Josh Gross 802876f7c7
Fix formatting 4 years ago
Josh Gross 2a34c33bd7
Export `GOROOT` for versions < 1.9 4 years ago
Manuel Mendez 83124a14b6 Do not export GOROOT
This has not been necessary since [Go 1.9](https://go.dev/doc/go1.9#goroot) at
least (although clunky to do so then) but definitely not since
[Go 1.10](https://go.dev/doc/go1.10#goroot).

This is cargo culting code that is more than 2 years out of date and runs into
issues when multiple go versions are used in an action run.

Signed-off-by: Manuel Mendez <mmendez534@gmail.com>
4 years ago
Dmitry Shibanov f6164bd8c8
Remove stable input and fix SemVer notation (#195) 4 years ago
Dmitry Shibanov bfdd3570ce
Implement "check-latest" flag to check if pre-cached version is latest one (#186) 4 years ago
Dmitry Shibanov 1616116e1b
Use GitHub releases to download Go versions. (#58) 6 years ago
Bryan MacFarlane 6613fc89fc go env block 6 years ago
Bryan MacFarlane 0dbc7e4965 toString 6 years ago
Bryan MacFarlane f32657ccaf output version of go it resolved to 6 years ago
Bryan MacFarlane cec6ecefb4 output version of go it resolved to 6 years ago
Bryan MacFarlane 1c06f0e82e couple tests 6 years ago
Bryan MacFarlane 262468e92f only needed to do once 6 years ago
Bryan MacFarlane 4e8106ca18 create profiles go dir if go installed but not exists 6 years ago
Bryan MacFarlane 93ddff5bef lint 6 years ago
Bryan MacFarlane 3d89e603f2 more debug 6 years ago
Bryan MacFarlane 1fea44b3f0 create bin if not under go env GOPATH 6 years ago
Bryan MacFarlane 3e014ec8a4 lint 6 years ago
Bryan MacFarlane 75899f8cdf add debug 6 years ago
Bryan MacFarlane 1fdcb9b160 oops 6 years ago
Bryan MacFarlane 3d0e3826ed prefer globally installed bin 6 years ago
Bryan MacFarlane 43880314e9 CR feedback 6 years ago
Bryan MacFarlane 7ea80d8e5f casing 6 years ago
Bryan MacFarlane a6a701e18e better user output 6 years ago
Bryan MacFarlane cfc658b90a format 6 years ago
Bryan MacFarlane 3c844703e7 bugs 6 years ago
Bryan MacFarlane dc575ee3b3 format 6 years ago
Bryan MacFarlane 4282769cc0 starting v2 and proxy support 6 years ago