Update to Go v1.22 (#13965)

* Bump go version up

* Update to go 1.22 compatible version

* Fix NoSec declarations

* Skip Gosec in GolangCi

* Avoid Bug In Analyzer

* Add in Gohashtree and Update to 1.22.4

* Fix Go Sum
This commit is contained in:
Nishant Das
2024-07-02 12:03:24 +08:00
committed by GitHub
parent 8c0d6b27d0
commit a8ecf5d118
9 changed files with 25 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
FROM golang:1.21-alpine FROM golang:1.22-alpine
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh

View File

@@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-go@v4 - uses: actions/setup-go@v4
with: with:
go-version: '1.21.5' go-version: '1.22.3'
- id: list - id: list
uses: shogo82148/actions-go-fuzz/list@v0 uses: shogo82148/actions-go-fuzz/list@v0
with: with:
@@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-go@v4 - uses: actions/setup-go@v4
with: with:
go-version: '1.21.5' go-version: '1.22.3'
- uses: shogo82148/actions-go-fuzz/run@v0 - uses: shogo82148/actions-go-fuzz/run@v0
with: with:
packages: ${{ matrix.package }} packages: ${{ matrix.package }}

View File

@@ -28,14 +28,14 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up Go 1.21 - name: Set up Go 1.22
uses: actions/setup-go@v3 uses: actions/setup-go@v3
with: with:
go-version: '1.21.5' go-version: '1.22.3'
- name: Run Gosec Security Scanner - name: Run Gosec Security Scanner
run: | # https://github.com/securego/gosec/issues/469 run: | # https://github.com/securego/gosec/issues/469
export PATH=$PATH:$(go env GOPATH)/bin export PATH=$PATH:$(go env GOPATH)/bin
go install github.com/securego/gosec/v2/cmd/gosec@v2.15.0 go install github.com/securego/gosec/v2/cmd/gosec@v2.19.0
gosec -exclude-generated -exclude=G307 -exclude-dir=crypto/bls/herumi ./... gosec -exclude-generated -exclude=G307 -exclude-dir=crypto/bls/herumi ./...
lint: lint:
@@ -45,10 +45,10 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up Go 1.21 - name: Set up Go 1.22
uses: actions/setup-go@v3 uses: actions/setup-go@v3
with: with:
go-version: '1.21.5' go-version: '1.22.3'
id: go id: go
- name: Golangci-lint - name: Golangci-lint
@@ -64,7 +64,7 @@ jobs:
- name: Set up Go 1.x - name: Set up Go 1.x
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: '1.21.5' go-version: '1.22.3'
id: go id: go
- name: Check out code into the Go module directory - name: Check out code into the Go module directory

View File

@@ -6,7 +6,7 @@ run:
- proto - proto
- tools/analyzers - tools/analyzers
timeout: 10m timeout: 10m
go: '1.21.5' go: '1.22.3'
linters: linters:
enable-all: true enable-all: true
@@ -52,6 +52,7 @@ linters:
- gofumpt - gofumpt
- gomnd - gomnd
- gomoddirectives - gomoddirectives
- gosec
- inamedparam - inamedparam
- interfacebloat - interfacebloat
- ireturn - ireturn

View File

@@ -182,7 +182,7 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe
go_rules_dependencies() go_rules_dependencies()
go_register_toolchains( go_register_toolchains(
go_version = "1.21.11", go_version = "1.22.4",
nogo = "@//:nogo", nogo = "@//:nogo",
) )

View File

@@ -2985,8 +2985,8 @@ def prysm_deps():
go_repository( go_repository(
name = "com_github_prysmaticlabs_gohashtree", name = "com_github_prysmaticlabs_gohashtree",
importpath = "github.com/prysmaticlabs/gohashtree", importpath = "github.com/prysmaticlabs/gohashtree",
sum = "h1:H/EbCuXPeTV3lpKeXGPpEV9gsUpkqOOVnWapUyeWro4=", sum = "h1:VK7thFOnhxAZ/5aolr5Os4beiubuD08WiuiHyRqgwks=",
version = "v0.0.4-beta", version = "v0.0.4-beta.0.20240624100937-73632381301b",
) )
go_repository( go_repository(
name = "com_github_prysmaticlabs_prombbolt", name = "com_github_prysmaticlabs_prombbolt",

6
go.mod
View File

@@ -1,8 +1,8 @@
module github.com/prysmaticlabs/prysm/v5 module github.com/prysmaticlabs/prysm/v5
go 1.21 go 1.22
toolchain go1.21.11 toolchain go1.22.4
require ( require (
contrib.go.opencensus.io/exporter/jaeger v0.2.1 contrib.go.opencensus.io/exporter/jaeger v0.2.1
@@ -272,7 +272,7 @@ require (
github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-playground/validator/v10 v10.13.0 github.com/go-playground/validator/v10 v10.13.0
github.com/peterh/liner v1.2.0 // indirect github.com/peterh/liner v1.2.0 // indirect
github.com/prysmaticlabs/gohashtree v0.0.4-beta github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b
golang.org/x/sys v0.20.0 // indirect golang.org/x/sys v0.20.0 // indirect
google.golang.org/api v0.44.0 // indirect google.golang.org/api v0.44.0 // indirect
google.golang.org/appengine v1.6.7 // indirect google.golang.org/appengine v1.6.7 // indirect

4
go.sum
View File

@@ -971,8 +971,8 @@ github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3/go.mod h1:h2
github.com/prysmaticlabs/go-bitfield v0.0.0-20210108222456-8e92c3709aa0/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s= github.com/prysmaticlabs/go-bitfield v0.0.0-20210108222456-8e92c3709aa0/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s=
github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e h1:ATgOe+abbzfx9kCPeXIW4fiWyDdxlwHw07j8UGhdTd4= github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e h1:ATgOe+abbzfx9kCPeXIW4fiWyDdxlwHw07j8UGhdTd4=
github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4= github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4=
github.com/prysmaticlabs/gohashtree v0.0.4-beta h1:H/EbCuXPeTV3lpKeXGPpEV9gsUpkqOOVnWapUyeWro4= github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b h1:VK7thFOnhxAZ/5aolr5Os4beiubuD08WiuiHyRqgwks=
github.com/prysmaticlabs/gohashtree v0.0.4-beta/go.mod h1:BFdtALS+Ffhg3lGQIHv9HDWuHS8cTvHZzrHWxwOtGOs= github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b/go.mod h1:HRuvtXLZ4WkaB1MItToVH2e8ZwKwZPY5/Rcby+CvvLY=
github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20230315201114-09284ba20446 h1:4wctORg/1TkgLgXejv9yOSAm3cDBJxoTzl/RNuZmX28= github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20230315201114-09284ba20446 h1:4wctORg/1TkgLgXejv9yOSAm3cDBJxoTzl/RNuZmX28=
github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20230315201114-09284ba20446/go.mod h1:IOyTYjcIO0rkmnGBfJTL0NJ11exy/Tc2QEuv7hCXp24= github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20230315201114-09284ba20446/go.mod h1:IOyTYjcIO0rkmnGBfJTL0NJ11exy/Tc2QEuv7hCXp24=
github.com/prysmaticlabs/prombbolt v0.0.0-20210126082820-9b7adba6db7c h1:9PHRCuO/VN0s9k+RmLykho7AjDxblNYI5bYKed16NPU= github.com/prysmaticlabs/prombbolt v0.0.0-20210126082820-9b7adba6db7c h1:9PHRCuO/VN0s9k+RmLykho7AjDxblNYI5bYKed16NPU=

View File

@@ -78,8 +78,7 @@ func (t *TransactionGenerator) Start(ctx context.Context) error {
} }
fundedAccount = newKey fundedAccount = newKey
rnd := make([]byte, 10000) rnd := make([]byte, 10000)
// #nosec G404 _, err = mathRand.Read(rnd) // #nosec G404
_, err = mathRand.Read(rnd)
if err != nil { if err != nil {
return err return err
} }
@@ -374,11 +373,9 @@ func kZGToVersionedHash(kzg kzg4844.Commitment) common.Hash {
} }
func randomBlobData() ([]byte, error) { func randomBlobData() ([]byte, error) {
// #nosec G404 size := mathRand.Intn(fieldparams.BlobSize) // #nosec G404
size := mathRand.Intn(fieldparams.BlobSize)
data := make([]byte, size) data := make([]byte, size)
// #nosec G404 n, err := mathRand.Read(data) // #nosec G404
n, err := mathRand.Read(data)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -389,12 +386,11 @@ func randomBlobData() ([]byte, error) {
} }
func randomAddress() common.Address { func randomAddress() common.Address {
// #nosec G404 rNum := mathRand.Int31n(5) // #nosec G404
switch mathRand.Int31n(5) { switch rNum {
case 0, 1, 2: case 0, 1, 2:
b := make([]byte, 20) b := make([]byte, 20)
// #nosec G404 _, err := mathRand.Read(b) // #nosec G404
_, err := mathRand.Read(b)
if err != nil { if err != nil {
panic(err) panic(err)
} }