From bddccaf69502d511fa983e15edd19955521cd108 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Sat, 26 Oct 2024 13:41:54 -0700 Subject: [PATCH] Update tinygo to 0.34.0, go min 1.19, go max 1.23 Commit https://github.com/tinygo-org/tinygo/commit/ac5f84e3d7b837643507fbd2b5af44b81a61af2e upstream changed the way the Go versions are expressed in the code to be something that's more friendly to scraping, so this scrapes the full range of Go versions instead of just the minimum (and updates the template to use the maximum supported version). --- tinygo/Dockerfile | 4 ++-- tinygo/Dockerfile.template | 2 +- tinygo/versions.json | 15 ++++++++++----- tinygo/versions.sh | 21 ++++++++++++++++----- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/tinygo/Dockerfile b/tinygo/Dockerfile index 3e6db0f7e0e..00070cb0e61 100644 --- a/tinygo/Dockerfile +++ b/tinygo/Dockerfile @@ -4,14 +4,14 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM golang:1.19-bookworm +FROM golang:1.23-bookworm # the .deb (as of 0.6.0) installs to /usr/local/tinygo but doesn't add "tinygo" to PATH ENV PATH /usr/local/tinygo/bin:$PATH # https://tinygo.org/getting-started/linux/ # https://github.com/tinygo-org/tinygo/releases -ENV TINYGO_VERSION 0.33.0 +ENV TINYGO_VERSION 0.34.0 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ diff --git a/tinygo/Dockerfile.template b/tinygo/Dockerfile.template index 4dde0ddf08c..e05d9476a79 100644 --- a/tinygo/Dockerfile.template +++ b/tinygo/Dockerfile.template @@ -1,4 +1,4 @@ -FROM golang:{{ .go.version }}-bookworm +FROM golang:{{ .go.max.version }}-bookworm # the .deb (as of 0.6.0) installs to /usr/local/tinygo but doesn't add "tinygo" to PATH ENV PATH /usr/local/tinygo/bin:$PATH diff --git a/tinygo/versions.json b/tinygo/versions.json index 33c834fd1f6..3c19887773b 100644 --- a/tinygo/versions.json +++ b/tinygo/versions.json @@ -1,9 +1,14 @@ { - "commit": "ef4f46f1d1550beb62324d750c496b2b4a7f76d0", - "ref": "refs/tags/v0.33.0", - "tag": "v0.33.0", - "version": "0.33.0", + "commit": "2a76ceb7dd5ea5a834ec470b724882564d9681b3", + "ref": "refs/tags/v0.34.0", + "tag": "v0.34.0", + "version": "0.34.0", "go": { - "version": "1.19" + "min": { + "version": "1.19" + }, + "max": { + "version": "1.23" + } } } diff --git a/tinygo/versions.sh b/tinygo/versions.sh index dae874c84c0..bf26058fa98 100755 --- a/tinygo/versions.sh +++ b/tinygo/versions.sh @@ -12,13 +12,24 @@ versions_hooks+=( hook_no-prereleases ) json="$(git-tags 'https://github.com/tinygo-org/tinygo.git')" tag="$(jq <<<"$json" -r '.tag')" + +# parse https://github.com/tinygo-org/tinygo/blob/v0.34.0/builder/config.go#L27-L29 to get the "range" of Go versions supported go="$( - wget -qO- "https://github.com/tinygo-org/tinygo/raw/$tag/go.mod" \ - | awk '$1 == "go" { print $2; exit }' + wget -qO- "https://github.com/tinygo-org/tinygo/raw/$tag/builder/config.go" \ + | jq -csR ' + [ + capture("((?<=\n)|^)[[:space:]]*const[[:space:]]+minor(?Min|Max)[[:space:]]*=[[:space:]]*(?[0-9]+)[[:space:]]*((?=\n)|$)"; "g") + | .key |= ascii_downcase + | .value |= { version: "1.\(.)" } + ] + | from_entries + | if has("min") and has("max") then . else + error("failed to scrape either min or max from upstream") + end + ' )" echo "tinygo go: $go" -# TODO this gives us the "minimal" version of Go, where it would be great if we could somehow parse https://github.com/tinygo-org/tinygo/blob/dc449882ad09c60c11cef7c35914d5fbfe22a88e/builder/config.go#L33 and get the "maximal" version instead -jq <<<"$json" --arg go "$go" ' - .go = { version: $go } +jq <<<"$json" --argjson go "$go" ' + .go = $go ' > versions.json