Skip to content

Commit

Permalink
ci: upgrade to Go 1.23 (#2301)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruces authored Aug 14, 2024
1 parent 2b12e18 commit 5ed4c17
Show file tree
Hide file tree
Showing 40 changed files with 90 additions and 120 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- 'netlify.toml'

env: # Update this prior to requiring a higher minor version in go.mod
GO_VERSION: "1.22"
GO_VERSION: "1.23"

defaults:
run: # use bash for all operating systems unless overridden
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
~/.cache/golangci-lint
~/go/pkg/mod
~/go/bin
key: check-${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum', 'Makefile') }}
key: check-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum', 'Makefile') }}

- run: make build.spectest

Expand All @@ -71,9 +71,8 @@ jobs:
- os: macos-14
arch: arm64
go-version:
- "1.23.0-rc.2" # Test the pending next version
- "1.22" # Current Go version
- "1.20" # Floor Go version of wazero (current - 2)
- "1.23" # Current Go version
- "1.21" # Floor Go version of wazero (current - 2)

steps:

Expand Down Expand Up @@ -113,9 +112,8 @@ jobs:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix: # Use versions consistent with wazero's Go support policy.
go-version:
- "1.23.0-rc.2" # Test the pending next version
- "1.22" # Current Go version
- "1.20" # Floor Go version of wazero (current - 2)
- "1.23" # Current Go version
- "1.21" # Floor Go version of wazero (current - 2)
arch:
- "amd64"
- "arm64"
Expand Down Expand Up @@ -160,7 +158,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
with: # Use version consistent with TinyGo.
go-version: "1.22"
- uses: acifani/setup-tinygo@v2
with:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
matrix: # Use versions consistent with TinyGo.
go-version:
- "1.22"
- "1.20"
- "1.21"

steps:
- name: Checkout
Expand Down Expand Up @@ -84,7 +84,6 @@ jobs:

- name: Build TinyGo examples
run: make build.examples.tinygo
if: matrix.go-version != '1.20' # fails with TinyGo v0.32.0

- name: Build AssemblyScript examples
run: make build.examples.as
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defaults:
shell: bash

env: # Update this prior to requiring a higher minor version in go.mod
GO_VERSION: "1.22"
GO_VERSION: "1.23"
TINYGO_VERSION: "0.32.0"
ZIG_VERSION: "0.11.0"
BINARYEN_VERSION: "116"
Expand Down Expand Up @@ -146,8 +146,8 @@ jobs:
- uses: actions/setup-go@v4
if: steps.binary-cache.outputs.cache-hit != 'true'
with:
go-version: ${{ env.GO_VERSION }}
with: # Use version consistent with TinyGo.
go-version: "1.22"

- name: Build Test Binaries
if: steps.binary-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -276,9 +276,8 @@ jobs:
name: Windows
arch: amd64
go-version:
- "1.23"
- "1.21"
- "1.22"
- "1.23.0-rc.2" # Test the pending next version

steps:
- id: setup-go
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
tags: 'v[0-9]+.[0-9]+.[0-9]+**' # Ex. v0.2.0 v0.2.1-rc2

env: # Update this prior to requiring a higher minor version in go.mod
GO_VERSION: "1.22"
GO_VERSION: "1.23"

defaults:
run: # use bash for all operating systems unless overridden
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

gofumpt := mvdan.cc/gofumpt@v0.5.0
gofumpt := mvdan.cc/gofumpt@v0.6.0
gosimports := github.com/rinchsan/gosimports/cmd/gosimports@v0.3.8
golangci_lint := github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
golangci_lint := github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.0
asmfmt := github.com/klauspost/asmfmt/cmd/asmfmt@v1.3.2
# sync this with netlify.toml!
hugo := github.com/gohugoio/hugo@v0.115.2
Expand Down
4 changes: 3 additions & 1 deletion experimental/close_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
"github.com/tetratelabs/wazero/internal/testing/require"
)

type arbitrary struct{}

// testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors.
var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary")
var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary")

func TestWithCloseNotifier(t *testing.T) {
tests := []struct {
Expand Down
4 changes: 3 additions & 1 deletion experimental/logging/log_listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import (
"github.com/tetratelabs/wazero/internal/wasm"
)

type arbitrary struct{}

// testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors.
var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary")
var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary")

func Test_loggingListener(t *testing.T) {
wasiFuncName := wasi.RandomGetName
Expand Down
4 changes: 3 additions & 1 deletion experimental/sock/sock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
"github.com/tetratelabs/wazero/internal/testing/require"
)

type arbitrary struct{}

// testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors.
var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary")
var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary")

func TestWithSockConfig(t *testing.T) {
tests := []struct {
Expand Down
4 changes: 1 addition & 3 deletions experimental/wazerotest/wazerotest.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,7 @@ func (f *Function) Call(ctx context.Context, params ...uint64) ([]uint64, error)
copy(stack, params)
err := f.CallWithStack(ctx, stack)
if err != nil {
for i := range stack {
stack[i] = 0
}
clear(stack)
}
return stack[:len(f.ResultTypes)], err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/tetratelabs/wazero

// Floor Go version of wazero (current - 2)
go 1.20
go 1.21

// All the beta tags are retracted and replaced with "pre" to prevent users
// from accidentally upgrading into the broken beta 1.
Expand Down
4 changes: 3 additions & 1 deletion imports/assemblyscript/assemblyscript_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ import (
"github.com/tetratelabs/wazero/sys"
)

type arbitrary struct{}

// testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors.
var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary")
var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary")

func TestAbort(t *testing.T) {
tests := []struct {
Expand Down
4 changes: 3 additions & 1 deletion imports/emscripten/emscripten_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ var growWasm []byte
//go:embed testdata/invoke.wasm
var invokeWasm []byte

type arbitrary struct{}

// testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors.
var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary")
var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary")

// TestGrow is an integration test until we have an Emscripten example.
func TestGrow(t *testing.T) {
Expand Down
4 changes: 1 addition & 3 deletions imports/wasi_snapshot_preview1/poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ func pollOneoffFn(_ context.Context, mod api.Module, params []uint64) sys.Errno
}
outBuf, ok := mem.Read(out, nsubscriptions*32)
// zero-out all buffer before writing
for i := range outBuf {
outBuf[i] = 0
}
clear(outBuf)

if !ok {
return sys.EFAULT
Expand Down
4 changes: 3 additions & 1 deletion imports/wasi_snapshot_preview1/wasi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import (
"github.com/tetratelabs/wazero/sys"
)

type arbitrary struct{}

// testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors.
var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary")
var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary")

const testMemoryPageSize = 1

Expand Down
9 changes: 2 additions & 7 deletions internal/descriptor/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,6 @@ func (t *Table[Key, Item]) Range(f func(Key, Item) bool) {

// Reset clears the content of the table.
func (t *Table[Key, Item]) Reset() {
for i := range t.masks {
t.masks[i] = 0
}
var zero Item
for i := range t.items {
t.items[i] = zero
}
clear(t.masks)
clear(t.items)
}
4 changes: 3 additions & 1 deletion internal/engine/interpreter/interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import (
"github.com/tetratelabs/wazero/internal/wasm"
)

type arbitrary struct{}

// testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors.
var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary")
var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary")

func TestInterpreter_peekValues(t *testing.T) {
ce := &callEngine{}
Expand Down
3 changes: 2 additions & 1 deletion internal/engine/wazevo/backend/isa/amd64/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func stackView(rbp, top uintptr) []byte {
l := int(top - rbp)
var stackBuf []byte
{
//nolint:staticcheck
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&stackBuf))
hdr.Data = rbp
hdr.Len = l
Expand Down Expand Up @@ -75,7 +76,7 @@ func GoCallStackView(stackPointerBeforeGoCall *uint64) []uint64 {
// (low address)
data := unsafe.Add(unsafe.Pointer(stackPointerBeforeGoCall), 8)
size := *stackPointerBeforeGoCall / 8
return unsafe.Slice((*uint64)(data), int(size))
return unsafe.Slice((*uint64)(data), size)
}

func AdjustClonedStack(oldRsp, oldTop, rsp, rbp, top uintptr) {
Expand Down
11 changes: 3 additions & 8 deletions internal/engine/wazevo/backend/isa/arm64/unwind_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func UnwindStack(sp, _, top uintptr, returnAddresses []uintptr) []uintptr {

var stackBuf []byte
{
//nolint:staticcheck
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&stackBuf))
hdr.Data = sp
hdr.Len = l
Expand Down Expand Up @@ -77,13 +78,7 @@ func GoCallStackView(stackPointerBeforeGoCall *uint64) []uint64 {
// +-----------------+ <---- stackPointerBeforeGoCall
// (low address)
ptr := unsafe.Pointer(stackPointerBeforeGoCall)
data := (*uint64)(unsafe.Add(ptr, 16)) // skips the (frame_size, sliceSize).
size := *(*uint64)(unsafe.Add(ptr, 8))
var view []uint64
{
sh := (*reflect.SliceHeader)(unsafe.Pointer(&view))
sh.Data = uintptr(unsafe.Add(ptr, 16)) // skips the (frame_size, sliceSize).
sh.Len = int(size)
sh.Cap = int(size)
}
return view
return unsafe.Slice(data, size)
}
4 changes: 1 addition & 3 deletions internal/engine/wazevo/backend/regalloc/regset.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ func newRegInUseSet[I Instr, B Block[I], F Function[I, B]]() regInUseSet[I, B, F
}

func (rs *regInUseSet[I, B, F]) reset() {
for i := range rs {
rs[i] = nil
}
clear(rs[:])
}

func (rs *regInUseSet[I, B, F]) format(info *RegisterInfo) string { //nolint:unused
Expand Down
2 changes: 2 additions & 0 deletions internal/engine/wazevo/call_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ func (c *callEngine) cloneStack(l uintptr) (newSP, newFP, newTop uintptr, newSta
// Copy the existing contents in the previous Go-allocated stack into the new one.
var prevStackAligned, newStackAligned []byte
{
//nolint:staticcheck
sh := (*reflect.SliceHeader)(unsafe.Pointer(&prevStackAligned))
sh.Data = c.stackTop - relSp
sh.Len = int(relSp)
Expand All @@ -563,6 +564,7 @@ func (c *callEngine) cloneStack(l uintptr) (newSP, newFP, newTop uintptr, newSta
{
newSP = newTop - relSp
newFP = newTop - relFp
//nolint:staticcheck
sh := (*reflect.SliceHeader)(unsafe.Pointer(&newStackAligned))
sh.Data = newSP
sh.Len = int(relSp)
Expand Down
1 change: 1 addition & 0 deletions internal/engine/wazevo/call_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func TestCallEngine_growStack(t *testing.T) {

var view []byte
{
//nolint:staticcheck
sh := (*reflect.SliceHeader)(unsafe.Pointer(&view))
sh.Data = newSP
sh.Len = 5
Expand Down
1 change: 1 addition & 0 deletions internal/engine/wazevo/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ func TestCompiledModule_functionIndexOf(t *testing.T) {
const executableAddr = 0xaaaa
var executable []byte
{
//nolint:staticcheck
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&executable))
hdr.Data = executableAddr
hdr.Len = 0xffff
Expand Down
2 changes: 0 additions & 2 deletions internal/engine/wazevo/frontend/sort_id.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build go1.21

package frontend

import (
Expand Down
17 changes: 0 additions & 17 deletions internal/engine/wazevo/frontend/sort_id_old.go

This file was deleted.

5 changes: 5 additions & 0 deletions internal/engine/wazevo/hostmodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func buildHostModuleOpaque(m *wasm.Module, listeners []experimental.FunctionList
binary.LittleEndian.PutUint64(ret[0:], uint64(uintptr(unsafe.Pointer(m))))

if len(listeners) > 0 {
//nolint:staticcheck
sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&listeners))
binary.LittleEndian.PutUint64(ret[8:], uint64(sliceHeader.Data))
binary.LittleEndian.PutUint64(ret[16:], uint64(sliceHeader.Len))
Expand All @@ -33,6 +34,7 @@ func buildHostModuleOpaque(m *wasm.Module, listeners []experimental.FunctionList

func hostModuleFromOpaque(opaqueBegin uintptr) *wasm.Module {
var opaqueViewOverSlice []byte
//nolint:staticcheck
sh := (*reflect.SliceHeader)(unsafe.Pointer(&opaqueViewOverSlice))
sh.Data = opaqueBegin
sh.Len = 32
Expand All @@ -42,6 +44,7 @@ func hostModuleFromOpaque(opaqueBegin uintptr) *wasm.Module {

func hostModuleListenersSliceFromOpaque(opaqueBegin uintptr) []experimental.FunctionListener {
var opaqueViewOverSlice []byte
//nolint:staticcheck
sh := (*reflect.SliceHeader)(unsafe.Pointer(&opaqueViewOverSlice))
sh.Data = opaqueBegin
sh.Len = 32
Expand All @@ -51,6 +54,7 @@ func hostModuleListenersSliceFromOpaque(opaqueBegin uintptr) []experimental.Func
l := binary.LittleEndian.Uint64(opaqueViewOverSlice[16:])
c := binary.LittleEndian.Uint64(opaqueViewOverSlice[24:])
var ret []experimental.FunctionListener
//nolint:staticcheck
sh = (*reflect.SliceHeader)(unsafe.Pointer(&ret))
sh.Data = uintptr(b)
sh.Len = int(l)
Expand All @@ -63,6 +67,7 @@ func hostModuleGoFuncFromOpaque[T any](index int, opaqueBegin uintptr) T {
ptr := opaqueBegin + offset

var opaqueViewOverFunction []byte
//nolint:staticcheck
sh := (*reflect.SliceHeader)(unsafe.Pointer(&opaqueViewOverFunction))
sh.Data = ptr
sh.Len = 16
Expand Down
Loading

0 comments on commit 5ed4c17

Please sign in to comment.