Skip to content

Commit

Permalink
Merge pull request #835 from self-five/tinygo-0.34
Browse files Browse the repository at this point in the history
Update tinygo to 0.34.0, go min 1.19, go max 1.23
  • Loading branch information
tianon authored Oct 26, 2024
2 parents e871db8 + bddccaf commit 77abb68
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
4 changes: 2 additions & 2 deletions tinygo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)"; \
Expand Down
2 changes: 1 addition & 1 deletion tinygo/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 10 additions & 5 deletions tinygo/versions.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
21 changes: 16 additions & 5 deletions tinygo/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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(?<key>Min|Max)[[:space:]]*=[[:space:]]*(?<value>[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

0 comments on commit 77abb68

Please sign in to comment.