Commit Graph

50 Commits (3c3eed866f215289ccdf5d17999eb6cc2a6c40be)

Author SHA1 Message Date
Arne Jørgensen 1adbf3753d
Add support for rc and beta versions in go.mod file
The regex in `parseGoVersionFile()` didn't consider rc and beta
versions. The regex has been extended.

In `findMatch()` the match is checked using `semver.satisfies()`. But
`semver.satisfies()` doesn't no about Go's non-semver rc and beta
version formats (1.16c1 instead of 1.16.0-rc.1).

We cannot use `makeSemver()` on `versionSpec` and compare the result
using `semver.satisfies()` because `versionSpec` could be, well, a
spec. Instead we first check if there is a strict match between the
candidate version and the versionSpec.

Fixes #525.
2 months ago
Priya Gupta 0778a10ce4
Migrate to ESM and upgrade dependencies (#763)
* Migrate to ESM and upgrade dependencies

* Remove unused tsconfig.eslint.json

* bump version to 7.0.0 in package.json and package-lock.json

* Add ESM migration note to README for V7

* Remove unnecessary devDependencies: ts-node, @types/jest

* npm audit fix

* Update README with ESM migration details

Clarified migration details to ESM for action compatibility.

* Downgrade @types/node to ^24, clean up tsconfig and README.
2 months ago
George Adams 8f19afcc70
feat: add go-download-base-url input for custom Go distributions (#721)
* 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

* run prettier

* fixup PR review

* revert cache-save

* fixup

* handle distinct cache

* skip json for known URL

* fix bug in JSON with custom URL
6 months ago
Masahiro Furudate 4b73464bb3
Fix golang download url to go.dev (#469)
* Fix golang download url to go.dev

* Fix const name

* Run `npm run build`
7 months ago
priya-kinthali faf52423ec
Add support for .tool-versions file in setup-go, update workflow (#673)
* setup go in local

* add .tool-versions file support
11 months ago
Nicholas Ngai 7bc60db215
Fall back to downloading from go.dev/dl instead of storage.googleapis.com/golang (#665)
* Fall back to downloading from dl.google.com/go instead of storage.googleapis.com/golang

* Use go.dev/dl instead
11 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>
1 year 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
1 year ago
Priya Gupta 29694d72cd
Add manifest validation and improve error handling (#586) 1 year ago
Priya Gupta dca8468d37
Update self-hosted environment validation and bump undici version (#556)
* Fix self-hosted environment check

* Update isSelfHosted logic
1 year ago
Tobias 3041bf56c9
feat: fallback to "raw" endpoint for manifest when rate limit is reached (#496)
* feat: fallback to "raw" endpoint for manifest when rate limit is reached

* add information about raw access to the README

* prettier

* update cross-spawn to 7.0.6 to fix vulnerability
2 years ago
Dmitry Shibanov 0c52d547c9
Update dependencies for node20 (#445) 3 years ago
galargh 48ac8fd236 chore: format 3 years ago
Piotr Galar 89a192af9d fix: sync .complete marker when caching tools on windows 3 years ago
Sergey Dolin 93397bea11
Fix Install on Windows is very slow (#393)
* Fix Install on Windows is very slow

* Add unit test

* Improve readability

* Add e2e test

* fix lint

* Fix unit tests

* Fix unit tests

* limit to github hosted runners

* test hosted version of go

* AzDev environment

* rename lnkSrc

* refactor conditions

* improve tests

* refactoring

* Fix e2e test

* improve isHosted readability
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
4 years ago
Serghei Iakovlev 807559307d
Use const declarations for variables that are never reassigned (#322) 4 years ago
Dmitry Shibanov 6edd4406fa
fix log for stable aliases (#303) 4 years ago
Milos Pantic 38dbe75f81
Add stable and oldstable aliases (#300) 4 years ago
koba1t 7678c83214
add support gowork for go-version-file 4 years ago
Milos Pantic 268d8c0ca0
Add support for arm32 go arch (#253) 4 years ago
Javier Romero e0dce94eb0 Use explicit filename when downloading Windows go package
Using the explicit filename for Windows is necessary to
satisfy `Expand-Archive`'s requirement on '.zip' extension.

Signed-off-by: Javier Romero <root@jromero.codes>
4 years ago
So Jomura 265edc1beb
Add go-version-file option (#62) 4 years ago
Dmitry Shibanov f6164bd8c8
Remove stable input and fix SemVer notation (#195) 5 years ago
Dmitry Shibanov bfdd3570ce
Implement "check-latest" flag to check if pre-cached version is latest one (#186) 5 years ago
Paul Cacheux bba6fe1d58 Fix extractor selection on windows 5 years ago
Maxim Lobanov d0c5defdf3
Switch manifest installation from "master" to "main" branch (#65)
* switch from master to main branch

* Update README.md
6 years ago
Dmitry Shibanov 1616116e1b
Use GitHub releases to download Go versions. (#58) 6 years ago
Bryan MacFarlane 3d0e3826ed prefer globally installed bin 7 years ago
Bryan MacFarlane 9c31f591e9 add bin to path 7 years ago
Bryan MacFarlane 9b1c41166a fix version dir 7 years ago
Bryan MacFarlane 655555d319 fix cache dir issue 7 years ago
Bryan MacFarlane 768458bd0b pre-release version and test 7 years ago
Bryan MacFarlane 43880314e9 CR feedback 7 years ago
Bryan MacFarlane a6a701e18e better user output 7 years ago
Bryan MacFarlane 6b10398c43 removed unneeded console.log 7 years ago
Bryan MacFarlane 6cb99a33d7 another test 7 years ago
Bryan MacFarlane 79b62adb05 another test and bugs 7 years ago
Bryan MacFarlane 7af81a4a65 bit of cleanup 7 years ago
Bryan MacFarlane f4b0281c15 mocked tests work with no internet 7 years ago
Bryan MacFarlane 3c844703e7 bugs 7 years ago
Bryan MacFarlane dc575ee3b3 format 7 years ago
Bryan MacFarlane 4282769cc0 starting v2 and proxy support 7 years ago
Ross Brodbeck 0cbaec8e4b Change getFileName to do architecture lookups and add arm support 7 years ago
Alif Rachmawadi 21620fff65
use golang-dl release data 7 years ago
Alif Rachmawadi 632d18fc92 Handle .x version syntax with latest release (#13)
* get latest release for .x syntax version

* added nock as dev dependency

* added test for .x syntax

* updated readme

* updated http client name

* use rest client for getting available versions

* more .x handling

* move nock to setup and teardown
7 years ago
Danny McCormick 90fdf52904 clean up 7 years ago
Danny McCormick f34fd68566 Add installer 7 years ago
Danny McCormick 263a218578 Temporarily remove installation so it can be reviewed 7 years ago
Danny McCormick cd176c696b Add setup-go 7 years ago