Commit Graph

51 Commits (145e58d96cc7ddecb2e7ccab0ed6dcf256ad88d4)

Author SHA1 Message Date
Matthew Hughes 145e58d96c 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_.

See (TODO link issue)
3 months ago
Matthew Hughes 763ffebcce 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, the action will install a version of Go, a
  toolchain will be detected, the toolchain will be detected and then
  another version of Go installed
* 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`
* TODO: link image

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
3 months ago
HarithaVattikuti 4ab57d7ea2
Fix versions check failure (#479)
* Update to latest Go versions

* Updated versions

* Update test data

* Update test data
8 months 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
1 year 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
2 years ago
Evgenii Korolevskii 17106403fa
Allow to use only GOCACHE for cache (#305) 2 years ago
Jongwoo Han bb5ff97ab9
refactor: Use early return pattern to avoid nested conditions (#302) 2 years ago
Milos Pantic 38dbe75f81
Add stable and oldstable aliases (#300) 2 years ago
koba1t 7678c83214
add support gowork for go-version-file 2 years ago
n33pm c4a742cab1
fix(): cache resolve version input (#267) 2 years ago
Evgenii Korolevskii 57452eb902 fix debug lines in test 2 years ago
Evgenii Korolevskii 5547b9ed8d fix(cache): Not throw err if no cache folders 2 years ago
Milos Pantic 268d8c0ca0
Add support for arm32 go arch (#253) 2 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>
2 years ago
IvanZosimov b22fbbc292
Implementation of caching functionality for setup-go action (#228) 3 years ago
So Jomura 265edc1beb
Add go-version-file option (#62) 3 years ago
Brian Cristante 193b404f8a
Successfully set up (#231) 3 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>
3 years ago
Josh Gross 0c03929337
Remove duplicated `spyOn` 3 years ago
Josh Gross 802876f7c7
Fix formatting 3 years ago
Josh Gross 2a34c33bd7
Export `GOROOT` for versions < 1.9 3 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>
3 years ago
Manuel Mendez ec07be593a Add test for export of GOROOT to env var
Signed-off-by: Manuel Mendez <mmendez534@gmail.com>
3 years ago
Dmitry Shibanov f6164bd8c8
Remove stable input and fix SemVer notation (#195) 3 years ago
Dmitry Shibanov bfdd3570ce
Implement "check-latest" flag to check if pre-cached version is latest one (#186) 3 years ago
Dominik Honnef fdeec47002
Don't require relative paths to start with ./ or ../ (#98) 3 years ago
Thomas Boop 37335c7bb2
Swap to Environment Files (#76)
* Swap to env files
4 years ago
Dmitry Shibanov 1616116e1b
Use GitHub releases to download Go versions. (#58) 5 years ago
Bryan MacFarlane e36ce1d6cf tabs or spaces 5 years ago
Bryan MacFarlane 0a62a734da another test case 5 years ago
Bryan MacFarlane 5156bc5dd3 lint 5 years ago
Bryan MacFarlane 7837b03976 more tests 5 years ago
Bryan MacFarlane 74c8095946 lint 5 years ago
Bryan MacFarlane 34223181a5 starting 5 years ago
Bryan MacFarlane 1c06f0e82e couple tests 5 years ago
Bryan MacFarlane 768458bd0b pre-release version and test 5 years ago
Bryan MacFarlane 43880314e9 CR feedback 5 years ago
Bryan MacFarlane 7d57e56d4d update tests 5 years ago
Bryan MacFarlane 6cb99a33d7 another test 5 years ago
Bryan MacFarlane 241a335117 mock os instead of system 5 years ago
Bryan MacFarlane 79b62adb05 another test and bugs 5 years ago
Bryan MacFarlane 7af81a4a65 bit of cleanup 5 years ago
Bryan MacFarlane f4b0281c15 mocked tests work with no internet 5 years ago
Bryan MacFarlane dc575ee3b3 format 5 years ago
Bryan MacFarlane 4282769cc0 starting v2 and proxy support 5 years ago
Alif Rachmawadi bc6edb526d
update test assertion 5 years ago
Alif Rachmawadi 21620fff65
use golang-dl release data 5 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
5 years ago
Stephen Franceschelli 136ed85710 Fix build. (#7)
* Fix.

* Husky commit correct node modules
6 years ago
Danny McCormick f34fd68566 Add installer 6 years ago