core, internal: use slices.Concat

This commit is contained in:
Hteev Oli 2024-10-29 13:59:47 +08:00 committed by GitHub
parent 4397c712ac
commit 6c53241c37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 12 deletions

View file

@ -22,6 +22,7 @@ import (
"errors"
"fmt"
"io"
"slices"
"strings"
"github.com/ethereum/go-ethereum/params"
@ -136,14 +137,9 @@ func (c *Container) MarshalBinary() []byte {
// Write section contents.
for _, ty := range c.types {
b = append(b, []byte{ty.inputs, ty.outputs, byte(ty.maxStackHeight >> 8), byte(ty.maxStackHeight & 0x00ff)}...)
}
for _, code := range c.codeSections {
b = append(b, code...)
}
for _, section := range encodedContainer {
b = append(b, section...)
b = append(b, ty.inputs, ty.outputs, byte(ty.maxStackHeight >> 8), byte(ty.maxStackHeight & 0x00ff))
}
b = slices.Concat(b, slices.Concat(c.codeSections...), slices.Concat(encodedContainer...))
b = append(b, c.data...)
return b

View file

@ -20,6 +20,7 @@ import (
"fmt"
"os"
"regexp"
"slices"
"sort"
"strings"
@ -50,11 +51,7 @@ func NewApp(usage string) *cli.App {
// Merge merges the given flag slices.
func Merge(groups ...[]cli.Flag) []cli.Flag {
var ret []cli.Flag
for _, group := range groups {
ret = append(ret, group...)
}
return ret
return slices.Concat(groups...)
}
var migrationApplied = map[*cli.Command]struct{}{}