Skip to content

Commit 6edf612

Browse files
committed
all: Go 1.21 support
1 parent 3871b83 commit 6edf612

File tree

6 files changed

+27
-7
lines changed

6 files changed

+27
-7
lines changed

.github/workflows/linux.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
# statically linked binary.
1919
runs-on: ubuntu-latest
2020
container:
21-
image: golang:1.20-alpine
21+
image: golang:1.21-alpine
2222
steps:
2323
- name: Install apk dependencies
2424
# tar: needed for actions/cache@v3
@@ -135,7 +135,7 @@ jobs:
135135
- name: Install Go
136136
uses: actions/setup-go@v3
137137
with:
138-
go-version: '1.20'
138+
go-version: '1.21'
139139
cache: true
140140
- name: Install wasmtime
141141
run: |
@@ -177,7 +177,7 @@ jobs:
177177
- name: Install Go
178178
uses: actions/setup-go@v3
179179
with:
180-
go-version: '1.20'
180+
go-version: '1.21'
181181
cache: true
182182
- name: Install Node.js
183183
uses: actions/setup-node@v3
@@ -290,7 +290,7 @@ jobs:
290290
- name: Install Go
291291
uses: actions/setup-go@v3
292292
with:
293-
go-version: '1.20'
293+
go-version: '1.21'
294294
cache: true
295295
- name: Restore LLVM source cache
296296
uses: actions/cache/restore@v3
@@ -407,7 +407,7 @@ jobs:
407407
- name: Install Go
408408
uses: actions/setup-go@v3
409409
with:
410-
go-version: '1.20'
410+
go-version: '1.21'
411411
cache: true
412412
- name: Restore LLVM source cache
413413
uses: actions/cache/restore@v3

builder/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func NewConfig(options *compileopts.Options) (*compileopts.Config, error) {
3333
if err != nil {
3434
return nil, fmt.Errorf("could not read version from GOROOT (%v): %v", goroot, err)
3535
}
36-
if major != 1 || minor < 18 || minor > 20 {
36+
if major != 1 || minor < 18 || minor > 21 {
3737
// Note: when this gets updated, also update the Go compatibility matrix:
3838
// https://github.com/tinygo-org/tinygo-site/blob/dev/content/docs/reference/go-compat-matrix.md
3939
return nil, fmt.Errorf("requires go version 1.18 through 1.20, got go%d.%d", major, minor)

src/internal/bytealg/bytealg.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,13 @@ func IndexRabinKarp(s, substr string) int {
251251
}
252252
return -1
253253
}
254+
255+
// MakeNoZero makes a slice of length and capacity n without zeroing the bytes.
256+
// It is the caller's responsibility to ensure uninitialized bytes
257+
// do not leak to the end user.
258+
func MakeNoZero(n int) []byte {
259+
// Note: this does zero the buffer even though that's not necessary.
260+
// For performance reasons we might want to change this (similar to the
261+
// malloc function implemented in the runtime).
262+
return make([]byte, n)
263+
}

src/runtime/baremetal.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ func growHeap() bool {
3838

3939
//export malloc
4040
func libc_malloc(size uintptr) unsafe.Pointer {
41+
// Note: this zeroes the returned buffer which is not necessary.
42+
// The same goes for bytealg.MakeNoZero.
4143
return alloc(size, nil)
4244
}
4345

src/runtime/runtime.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,8 @@ func godebug_setUpdate(update func(string, string)) {
100100
// variable changes (for example, via os.Setenv).
101101
godebugUpdate = update
102102
}
103+
104+
//go:linkname godebug_setNewIncNonDefault internal/godebug.setNewIncNonDefault
105+
func godebug_setNewIncNonDefault(newIncNonDefault func(string) func()) {
106+
// Dummy function necessary in Go 1.21.
107+
}

src/runtime/symtab.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ type Frames struct {
55
}
66

77
type Frame struct {
8+
PC uintptr
9+
10+
Func *Func
11+
812
Function string
913

1014
File string
1115
Line int
12-
PC uintptr
1316
}
1417

1518
func CallersFrames(callers []uintptr) *Frames {

0 commit comments

Comments
 (0)