Skip to content

Commit

Permalink
Merge pull request #22 from WillAbides/go121
Browse files Browse the repository at this point in the history
go 1.21 redux
  • Loading branch information
WillAbides committed Aug 8, 2023
2 parents 7dca198 + 5d033a1 commit b0148f8
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 56 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/integration.yml
Expand Up @@ -137,3 +137,43 @@ jobs:
[[ "$(go version)" == *"1.13"* ]]
[[ '${{steps.setup_go_1_13_x.outputs.GOROOT}}' == *"1.13"* ]]
[[ '${{steps.setup_go_1_13_x.outputs.GOTOOLDIR}}' == *"1.13"* ]]
- id: setup_go_1_21
name: install 1.21
uses: ./
with:
go-version: '1.21'
ignore-local: true
debug: true
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_1_21.outputs ) }}' | jq .
go version
set -ex
[[ "$(go version)" == *"1.21.0"* ]]
[[ '${{steps.setup_go_1_21.outputs.GOROOT}}' == *"1.21.0"* ]]
[[ '${{steps.setup_go_1_21.outputs.GOTOOLDIR}}' == *"1.21.0"* ]]
- id: setup_go_1_21_0
name: install 1.21.0
uses: ./
with:
go-version: '1.21.0'
ignore-local: true
debug: true
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_1_21.outputs ) }}' | jq .
go version
set -ex
[[ "$(go version)" == *"1.21.0"* ]]
[[ '${{steps.setup_go_1_21.outputs.GOROOT}}' == *"1.21.0"* ]]
[[ '${{steps.setup_go_1_21.outputs.GOTOOLDIR}}' == *"1.21.0"* ]]
13 changes: 4 additions & 9 deletions README.md
Expand Up @@ -4,16 +4,11 @@ It's like actions/setup-go but faster.

## A Note About Go 1.21.0

**Use setup-go-faster@v1.9.0 or later** if you want to install Go 1.21.0.
**Use setup-go-faster@v1.9.1 or later** if you want to install Go 1.21.0.

With the release of go1.21.0, the Go team has changed the way they publish
dot-zero releases. They used to be styles go1.N, but now that are go1.N.0. This
caused issues with earlier versions of setup-go-faster.

**Do not user go-version: 1.21**. Use `go-version: 1.21.0`
or `go-version: 1.21.x` instead.

I should fix these inconsistencies soon.
With the release of go1.21.0, the Go team has changed the way they style
dot-zero releases. They used to be styled like `go1.N`, but now they are
`go1.N.0`. This caused issues with earlier versions of setup-go-faster.

### Faster

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Expand Up @@ -69,9 +69,9 @@ runs:
- id: run
working-directory: ${{ github.action_path }}
env:
DEBUG: ""
IGNORE_LOCAL_GO: ${{ inputs.ignore-local }}
GO_VERSION: ${{ inputs.go-version }}
DEBUG: ""
shell: bash
run: src/run
branding:
Expand Down
86 changes: 43 additions & 43 deletions bindown.yml
@@ -1,6 +1,6 @@
systems:
- darwin/amd64
- linux/amd64
- darwin/amd64
- linux/amd64
dependencies:
action-doc:
template: action-doc#action-doc
Expand All @@ -16,7 +16,7 @@ dependencies:
vars:
version: 3.1.0
required_vars:
- version
- version
shellcheck:
template: origin#shellcheck
vars:
Expand All @@ -27,39 +27,37 @@ dependencies:
vars:
ref: ebc4baa08f045b7ef0f45c4b7d6f34f08d732f3d
required_vars:
- ref
- ref
templates:
action-doc#action-doc:
url: https://github.com/WillAbides/action-doc/releases/download/v{{.version}}/action-doc_{{.version}}_{{.os}}_{{.arch}}.tar.gz
required_vars:
- version
systems:
- darwin/amd64
- linux/386
- linux/amd64
- darwin/amd64
- linux/386
- linux/amd64
required_vars:
- version
origin#octo:
url: https://github.com/octo-cli/octo-cli/releases/download/v{{.version}}/octo-cli_{{.version}}_{{.os}}_{{.arch}}.tar.gz
archive_path: octo{{.archivepathsuffix}}
bin: octo
vars:
archivepathsuffix: ""
required_vars:
- version
overrides:
- matcher:
os:
- windows
dependency:
vars:
archivepathsuffix: .exe
- matcher:
arch:
- arm64
os:
- darwin
dependency:
vars:
arch: amd64
- matcher:
os:
- windows
dependency:
vars:
archivepathsuffix: .exe
- matcher:
arch:
- arm64
os:
- darwin
dependency:
vars:
arch: amd64
substitutions:
arch:
"386": i386
Expand All @@ -69,33 +67,35 @@ templates:
linux: Linux
windows: Windows
systems:
- darwin/386
- darwin/amd64
- darwin/arm64
- linux/386
- linux/amd64
- windows/386
- windows/amd64
- darwin/386
- darwin/amd64
- darwin/arm64
- linux/386
- linux/amd64
- windows/386
- windows/amd64
required_vars:
- version
origin#shellcheck:
url: https://github.com/koalaman/shellcheck/releases/download/v{{.version}}/shellcheck-v{{.version}}.{{.os}}.{{.arch}}.tar.xz
archive_path: shellcheck-v{{.version}}/shellcheck
bin: shellcheck
required_vars:
- version
overrides:
- matcher:
os:
- windows
dependency:
url: https://github.com/koalaman/shellcheck/releases/download/v{{.version}}/shellcheck-v{{.version}}.zip
archive_path: shellcheck-v{{.version}}.exe
- matcher:
os:
- windows
dependency:
url: https://github.com/koalaman/shellcheck/releases/download/v{{.version}}/shellcheck-v{{.version}}.zip
archive_path: shellcheck-v{{.version}}.exe
substitutions:
arch:
amd64: x86_64
systems:
- darwin/amd64
- linux/amd64
- windows/amd64
- darwin/amd64
- linux/amd64
- windows/amd64
required_vars:
- version
template_sources:
action-doc: https://raw.githubusercontent.com/WillAbides/action-doc/main/bindown.yml
origin: https://raw.githubusercontent.com/WillAbides/bindown-templates/master/bindown.yml
Expand Down
2 changes: 1 addition & 1 deletion script/bindown
Expand Up @@ -6,6 +6,6 @@ CDPATH="" cd -- "$(dirname -- "$(dirname -- "$0")")"

mkdir -p bin

[ -f bin/bindown ] || sh -c "$(curl -sfL https://github.com/WillAbides/bindown/releases/download/v3.10.1/bootstrap-bindown.sh)"
[ -f bin/bindown ] || sh -c "$(curl -sfL https://github.com/WillAbides/bindown/releases/download/v4.6.0/bootstrap-bindown.sh)"

exec bin/bindown "$@"
6 changes: 4 additions & 2 deletions src/lib
Expand Up @@ -72,6 +72,7 @@ download_go_url() {
install_go() {
local go_version="$1"
local target_dir="$2"
debug_out "installing go $go_version to $target_dir"
rm -rf "$target_dir"
mkdir -p "$(dirname "$target_dir")"
tmpdir="$(init_tmpdir)"
Expand Down Expand Up @@ -113,8 +114,9 @@ exe_name() {
}

is_precise_version() {
[[ $1 =~ ^[0-9]+(.[0-9]+(.[0-9]+)?)?([A-Za-z0-9]+)?$ ]] && return
return 1
[[ $1 =~ ^[0-9]+(.([0-9]+)(.[0-9]+)?)?([A-Za-z0-9]+)?$ ]] || return 1
# false when minor is >= 21 and patch is empty
[ -z "${BASH_REMATCH[2]}" ] || [ "${BASH_REMATCH[2]}" -lt 21 ] || [ -n "${BASH_REMATCH[3]}" ]
}

select_go_version() {
Expand Down
3 changes: 3 additions & 0 deletions src/lib_test.sh
Expand Up @@ -40,6 +40,8 @@ test_is_precise_version() {
9999.9999.9999
1.15beta1
1.16rc1
1.21.0
1.21.1
'

for v in $versions; do
Expand All @@ -48,6 +50,7 @@ test_is_precise_version() {
done

not_versions='
1.21
*
1.x
1.15.x
Expand Down

0 comments on commit b0148f8

Please sign in to comment.