ci: bump to go 1.23 (#453)

Upgrade to Go 1.23.

Upgrade also requires bumping `golangci-lint` to v1.62.2, and upgrading
third-party test versions for some failing cases.
This commit is contained in:
Michael McLoughlin
2024-12-22 19:01:48 -05:00
committed by GitHub
parent 3b84ecd27b
commit b985ff5775
31 changed files with 88 additions and 100 deletions

View File

@@ -97,7 +97,7 @@ func (f *Function) Signature() Signature {
n := f.Arity()
ops := make([]string, n)
count := map[string]int{}
for j := 0; j < n; j++ {
for j := range n {
// Collect unique lowercase bytes from first characters of operand types.
s := map[byte]bool{}
for _, form := range f.Forms {

View File

@@ -12,7 +12,6 @@ func TestFunctionsDuplicateFormSignatures(t *testing.T) {
// manifest as duplicate case statements in generated code.
fns := InstructionsFunctions(inst.Instructions)
for _, fn := range fns {
fn := fn // scopelint
t.Run(fn.Name(), func(t *testing.T) {
seen := map[string]bool{}
for _, f := range fn.Forms {
@@ -36,7 +35,7 @@ func TestFunctionsUniqueArgNames(t *testing.T) {
continue
}
names := map[string]bool{}
for j := 0; j < n; j++ {
for j := range n {
names[s.ParameterName(j)] = true
}
if len(names) != n {

View File

@@ -58,18 +58,18 @@ func (t *optab) Generate(is []inst.Instruction) ([]byte, error) {
}
func (t *optab) maxOperands(is []inst.Instruction) {
max := 0
mx := 0
for _, i := range inst.Instructions {
for _, f := range i.Forms {
a := len(f.Operands) + len(f.ImplicitOperands)
if a > max {
max = a
if a > mx {
mx = a
}
}
}
t.Comment("maxoperands is the maximum number of operands in an instruction form, including implicit operands.")
t.Printf("const maxoperands = %d\n\n", max)
t.Printf("const maxoperands = %d\n\n", mx)
}
func (t *optab) operandTypeEnum(is []inst.Instruction) {
@@ -109,17 +109,17 @@ func (t *optab) implicitRegisterEnum(is []inst.Instruction) {
func (t *optab) suffixesType(is []inst.Instruction) {
// Declare the type as an array. This requires us to know the maximum number
// of suffixes an instruction can have.
max := 0
mx := 0
for _, class := range inst.SuffixesClasses(is) {
for _, suffixes := range class {
if len(suffixes) > max {
max = len(suffixes)
if len(suffixes) > mx {
mx = len(suffixes)
}
}
}
t.Comment("maxsuffixes is the maximum number of suffixes an instruction can have.")
t.Printf("const maxsuffixes = %d\n\n", max)
t.Printf("const maxsuffixes = %d\n\n", mx)
name := t.table.SuffixesTypeName()
t.Printf("type %s [maxsuffixes]%s\n", name, t.table.Suffix().Name())

View File

@@ -44,7 +44,7 @@ func TestFormDupes(t *testing.T) {
func HasFormDupe(i inst.Instruction) bool {
n := len(i.Forms)
for a := 0; a < n; a++ {
for a := range n {
for b := a + 1; b < n; b++ {
if reflect.DeepEqual(i.Forms[a], i.Forms[b]) {
return true

View File

@@ -7,10 +7,10 @@ import (
"strings"
)
// Frames returns at most max callstack Frames, starting with its caller and
// Frames returns at most mx callstack Frames, starting with its caller and
// skipping skip Frames.
func Frames(skip, max int) []runtime.Frame {
pc := make([]uintptr, max)
func Frames(skip, mx int) []runtime.Frame {
pc := make([]uintptr, mx)
n := runtime.Callers(skip+2, pc)
if n == 0 {
return nil

View File

@@ -25,6 +25,7 @@ func TestMatchFirst(t *testing.T) {
first := stack.Match(0, func(_ runtime.Frame) bool { return true })
if first == nil {
t.Fatalf("nil match")
return
}
got := first.Function
expect := pkg + ".TestMatchFirst"