Skip to content

Commit

Permalink
all: add Go 1.24 support
Browse files Browse the repository at this point in the history
  • Loading branch information
aykevl committed Feb 21, 2025
1 parent b172cac commit 119f819
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 30 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ jobs:
# "make lint" fails before go 1.21 because internal/tools/go.mod specifies packages that require go 1.21
fmt-check: false
resource_class: large
test-llvm19-go123:
test-llvm19-go124:
docker:
- image: golang:1.23-bullseye
- image: golang:1.24-bullseye
steps:
- test-linux:
llvm: "19"
Expand All @@ -124,4 +124,4 @@ workflows:
# least the smoke tests still pass.
- test-llvm15-go119
# This tests LLVM 19 support when linking against system libraries.
- test-llvm19-go123
- test-llvm19-go124
4 changes: 2 additions & 2 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.24'
cache: true
- name: Restore LLVM source cache
uses: actions/cache/restore@v4
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.24'
cache: true
- name: Build TinyGo (LLVM ${{ matrix.version }})
run: go install -tags=llvm${{ matrix.version }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
# statically linked binary.
runs-on: ubuntu-latest
container:
image: golang:1.23-alpine
image: golang:1.24-alpine
outputs:
version: ${{ steps.version.outputs.version }}
steps:
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.24'
cache: true
- name: Install wasmtime
uses: bytecodealliance/actions/wasmtime/setup@v1
Expand Down Expand Up @@ -189,7 +189,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.24'
cache: true
- name: Install Node.js
uses: actions/setup-node@v4
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.24'
cache: true
- name: Restore LLVM source cache
uses: actions/cache/restore@v4
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.24'
cache: true
- name: Restore cached LLVM source
uses: actions/cache/restore@v4
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.24'
cache: true
- name: Download TinyGo build
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.24'
cache: true
- name: Download TinyGo build
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -222,7 +222,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.24'
cache: true
- name: Download TinyGo build
uses: actions/download-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# tinygo-llvm stage obtains the llvm source for TinyGo
FROM golang:1.23 AS tinygo-llvm
FROM golang:1.24 AS tinygo-llvm

RUN apt-get update && \
apt-get install -y apt-utils make cmake clang-15 ninja-build && \
Expand Down Expand Up @@ -33,7 +33,7 @@ RUN cd /tinygo/ && \

# tinygo-compiler copies the compiler build over to a base Go container (without
# all the build tools etc).
FROM golang:1.23 AS tinygo-compiler
FROM golang:1.24 AS tinygo-compiler

# Copy tinygo build.
COPY --from=tinygo-compiler-build /tinygo/build/release/tinygo /tinygo
Expand Down
7 changes: 0 additions & 7 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,6 @@ TEST_PACKAGES_FAST = \
unique \
$(nil)

# Assume this will go away before Go2, so only check minor version.
ifeq ($(filter $(shell $(GO) env GOVERSION | cut -f 2 -d.), 16 17 18), )
TEST_PACKAGES_FAST += crypto/internal/nistec/fiat
else
TEST_PACKAGES_FAST += crypto/elliptic/internal/fiat
endif

# archive/zip requires os.ReadAt, which is not yet supported on windows
# bytes requires mmap
# compress/flate appears to hang on wasi
Expand Down
4 changes: 2 additions & 2 deletions builder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewConfig(options *compileopts.Options) (*compileopts.Config, error) {

// Version range supported by TinyGo.
const minorMin = 19
const minorMax = 23
const minorMax = 24

// Check that we support this Go toolchain version.
gorootMajor, gorootMinor, err := goenv.GetGorootVersion()
Expand All @@ -36,7 +36,7 @@ func NewConfig(options *compileopts.Options) (*compileopts.Config, error) {
if gorootMajor != 1 || gorootMinor < minorMin || gorootMinor > minorMax {
// Note: when this gets updated, also update the Go compatibility matrix:
// https://github.com/tinygo-org/tinygo-site/blob/dev/content/docs/reference/go-compat-matrix.md
return nil, fmt.Errorf("requires go version 1.19 through 1.23, got go%d.%d", gorootMajor, gorootMinor)
return nil, fmt.Errorf("requires go version 1.%d through 1.%d, got go%d.%d", minorMin, minorMax, gorootMajor, gorootMinor)
}

// Check that the Go toolchain version isn't too new, if we haven't been
Expand Down
2 changes: 1 addition & 1 deletion builder/sizes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestBinarySize(t *testing.T) {
// microcontrollers
{"hifive1b", "examples/echo", 4560, 280, 0, 2268},
{"microbit", "examples/serial", 2916, 388, 8, 2272},
{"wioterminal", "examples/pininterrupt", 7315, 1489, 116, 6912},
{"wioterminal", "examples/pininterrupt", 7359, 1489, 116, 6912},

// TODO: also check wasm. Right now this is difficult, because
// wasm binaries are run through wasm-opt and therefore the
Expand Down
11 changes: 6 additions & 5 deletions compiler/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ var stdlibAliases = map[string]string{
// crypto packages
"crypto/ed25519/internal/edwards25519/field.feMul": "crypto/ed25519/internal/edwards25519/field.feMulGeneric",
"crypto/internal/edwards25519/field.feSquare": "crypto/ed25519/internal/edwards25519/field.feSquareGeneric",
"crypto/md5.block": "crypto/md5.blockGeneric",
"crypto/sha1.block": "crypto/sha1.blockGeneric",
"crypto/sha1.blockAMD64": "crypto/sha1.blockGeneric",
"crypto/sha256.block": "crypto/sha256.blockGeneric",
"crypto/sha512.blockAMD64": "crypto/sha512.blockGeneric",
"crypto/md5.block": "crypto/md5.blockGeneric",
"crypto/sha1.block": "crypto/sha1.blockGeneric",
"crypto/sha1.blockAMD64": "crypto/sha1.blockGeneric",
"crypto/sha256.block": "crypto/sha256.blockGeneric",
"crypto/sha512.blockAMD64": "crypto/sha512.blockGeneric",
"internal/chacha8rand.block": "internal/chacha8rand.block_generic",

// AES
"crypto/aes.decryptBlockAsm": "crypto/aes.decryptBlock",
Expand Down
7 changes: 7 additions & 0 deletions src/internal/abi/type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package abi

type Type struct {
// Intentionally left empty. TinyGo uses a different way to represent types,
// so this is unimplementable. The type definition here is purely for
// compatibility.
}
4 changes: 4 additions & 0 deletions src/reflect/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ func (v Value) Comparable() bool {
}
}

func (v Value) Equal(u Value) bool {
panic("unimplemented: reflect.Value.Equal")
}

func (v Value) Addr() Value {
if !v.CanAddr() {
panic("reflect.Value.Addr of unaddressable value")
Expand Down
15 changes: 15 additions & 0 deletions src/runtime/synctest.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package runtime

// Dummy implementation of synctest functions (we don't support synctest at the
// moment).

//go:linkname synctest_acquire internal/synctest.acquire
func synctest_acquire() any {
// Dummy: we don't support synctest.
return nil
}

//go:linkname synctest_release internal/synctest.release
func synctest_release(sg any) {
// Dummy: we don't support synctest.
}
13 changes: 13 additions & 0 deletions src/runtime/time.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
package runtime

//go:linkname time_runtimeNano time.runtimeNano
func time_runtimeNano() int64 {
// Note: we're ignoring sync groups here (package testing/synctest).
// See: https://github.com/golang/go/issues/67434
return nanotime()
}

//go:linkname time_runtimeNow time.runtimeNow
func time_runtimeNow() (sec int64, nsec int32, mono int64) {
// Also ignoring the sync group here, like time_runtimeNano above.
return now()
}

// timerNode is an element in a linked list of timers.
type timerNode struct {
next *timerNode
Expand Down

0 comments on commit 119f819

Please sign in to comment.