Skip to content

Commit

Permalink
Merge pull request #5556 from oasisprotocol/ptrus/feature/go-1.22
Browse files Browse the repository at this point in the history
go: Bump go to 1.22.0
  • Loading branch information
ptrus authored Feb 14, 2024
2 parents fd0b0d6 + 43ebafd commit 91855c3
Show file tree
Hide file tree
Showing 56 changed files with 108 additions and 94 deletions.
7 changes: 7 additions & 0 deletions .changelog/5556.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
go: Bump go to 1.22.0

Also updates go tooling:

- golangci-lint to 1.56.1
- gofumpt to 0.6.0
- goimports to 0.18.0
2 changes: 1 addition & 1 deletion .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
go-version: "1.22.x"
- name: Set up Rust
run: rustup show
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-reproducibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
go-version: "1.22.x"
- name: Set up Rust
working-directory: build${{ matrix.build_number }}
run: rustup show
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
go-version: "1.22.x"
- name: Set up Rust
run: rustup show
- name: Install Oasis Node prerequisites
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
go-version: "1.22.x"

- name: Set up Rust
run: rustup show
Expand Down
8 changes: 4 additions & 4 deletions docker/oasis-core-dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM ubuntu:22.04

# Package versions.
ARG GO_VERSION=1.21.0
ARG GO_VERSION=1.22.0
ARG GO_NANCY_VERSION=1.0.33
ARG GO_NANCY_CHECKSUM=a4bf5290d41b095c04f941ed5380674770c79d59735e33b1bd07a5cd5fbb135d
ARG GO_PROTOC_VERSION=3.6.1
ARG GO_PROTOC_GEN_GO_VERSION=1.21.0
ARG GOLANGCILINT_VERSION=1.54.2
ARG GOLANGCILINT_VERSION=1.56.1
ARG GOCOVMERGE_VERSION=b5bfa59ec0adc420475f97f89b58045c721d761c
ARG GOFUMPT_VERSION=v0.5.0
ARG GOIMPORTS_VERSION=v0.12.0
ARG GOFUMPT_VERSION=v0.6.0
ARG GOIMPORTS_VERSION=v0.18.0
ARG RUST_NIGHTLY_VERSION=2024-01-08
ARG JEMALLOC_VERSION=5.2.1
ARG JEMALLOC_CHECKSUM=34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6
Expand Down
16 changes: 8 additions & 8 deletions docs/development-setup/prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Core:
```
<!-- markdownlint-enable line-length -->

* [Go] (at least version 1.21.0).
* [Go] (at least version 1.22.0).

If your distribution provides a new-enough version of Go, just use that.

Expand All @@ -52,18 +52,18 @@ Core:
* [ensure `$GOPATH/bin` is in your `PATH`](
https://tip.golang.org/doc/code.html#GOPATH),
* [install the desired version of Go](
https://golang.org/doc/install#extra_versions), e.g. 1.21.0, with:
https://golang.org/doc/install#extra_versions), e.g. 1.22.0, with:

```
go install golang.org/dl/go1.21.0@latest
go1.21.0 download
go install golang.org/dl/go1.22.0@latest
go1.22.0 download
```

* instruct the build system to use this particular version of Go by setting
the `OASIS_GO` environment variable in your `~/.bashrc`:

```
export OASIS_GO=go1.21.0
export OASIS_GO=go1.22.0
```

* [Rust].
Expand Down Expand Up @@ -137,8 +137,8 @@ Core:
Download and install it with:

```
${OASIS_GO:-go} install mvdan.cc/gofumpt@v0.5.0
${OASIS_GO:-go} install golang.org/x/tools/cmd/goimports@v0.12.0
${OASIS_GO:-go} install mvdan.cc/gofumpt@v0.6.0
${OASIS_GO:-go} install golang.org/x/tools/cmd/goimports@v0.18.0
```

* (**OPTIONAL**) [golangci-lint].
Expand All @@ -151,7 +151,7 @@ Core:
```
curl -sSfL \
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sh -s -- -b $(${OASIS_GO:-go} env GOPATH)/bin v1.54.2
| sh -s -- -b $(${OASIS_GO:-go} env GOPATH)/bin v1.56.1
```

* (**OPTIONAL**) [protoc-gen-go].
Expand Down
3 changes: 3 additions & 0 deletions go/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
linters-settings:
goconst:
ignore-tests: true
ignore-strings: 'unix:.*'
goimports:
# Put local imports after 3rd-party packages.
local-prefixes: github.com/oasisprotocol/oasis-core
Expand Down
2 changes: 1 addition & 1 deletion go/beacon/api/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func handlerGetBaseEpoch(
Server: srv,
FullMethod: methodGetBaseEpoch.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return srv.(Backend).GetBaseEpoch(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand Down
2 changes: 1 addition & 1 deletion go/common/crash/crash.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func ListRegisteredCrashPoints() []string {
// ListRegisteredCrashPoints lists the registered crash points for a Crasher instance.
func (c *Crasher) ListRegisteredCrashPoints() []string {
var crashPointIDs []string
c.CrashPointConfig.Range(func(k, v interface{}) bool {
c.CrashPointConfig.Range(func(k, _ interface{}) bool {
crashPointIDs = append(crashPointIDs, k.(string))
return true
})
Expand Down
6 changes: 3 additions & 3 deletions go/common/crypto/signature/signers/remote/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func handlerPublicKeys(
Server: srv,
FullMethod: methodPublicKeys.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(_ context.Context, _ interface{}) (interface{}, error) {
return srv.(Backend).PublicKeys()
}
return interceptor(ctx, nil, info, handler)
Expand All @@ -148,7 +148,7 @@ func handlerSign(
Server: srv,
FullMethod: methodSign.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(_ context.Context, req interface{}) (interface{}, error) {
return srv.(Backend).Sign(req.(*SignRequest))
}
return interceptor(ctx, &req, info, handler)
Expand All @@ -171,7 +171,7 @@ func handlerProve(
Server: srv,
FullMethod: methodProve.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(_ context.Context, req interface{}) (interface{}, error) {
return srv.(Backend).Prove(req.(*ProveRequest))
}
return interceptor(ctx, &req, info, handler)
Expand Down
4 changes: 2 additions & 2 deletions go/common/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,14 +643,14 @@ func NewServer(config *ServerConfig) (*Server, error) {
if config.Identity != nil && config.Identity.TLSCertificate != nil {
tlsConfig := &tls.Config{
ClientAuth: clientAuthType,
VerifyPeerCertificate: func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
VerifyPeerCertificate: func(rawCerts [][]byte, _ [][]*x509.Certificate) error {
return cmnTLS.VerifyCertificate(rawCerts, cmnTLS.VerifyOptions{
CommonName: config.ClientCommonName,
AllowUnknownKeys: true,
AllowNoCertificate: true,
})
},
GetCertificate: func(ch *tls.ClientHelloInfo) (*tls.Certificate, error) {
GetCertificate: func(_ *tls.ClientHelloInfo) (*tls.Certificate, error) {
return config.Identity.TLSCertificate, nil
},
}
Expand Down
4 changes: 2 additions & 2 deletions go/common/grpc/testing/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var (
serviceName = cmnGrpc.NewServiceName("PingService")
// MethodPing is the Ping method.
MethodPing = serviceName.NewMethod("Ping", PingQuery{}).
WithNamespaceExtractor(func(ctx context.Context, req interface{}) (common.Namespace, error) {
WithNamespaceExtractor(func(_ context.Context, req interface{}) (common.Namespace, error) {
r, ok := req.(*PingQuery)
if !ok {
return common.Namespace{}, errInvalidRequestType
Expand All @@ -42,7 +42,7 @@ var (

// MethodWatchPings is the WatchPings method.
MethodWatchPings = serviceName.NewMethod("WatchPings", PingQuery{}).
WithNamespaceExtractor(func(ctx context.Context, req interface{}) (common.Namespace, error) {
WithNamespaceExtractor(func(_ context.Context, req interface{}) (common.Namespace, error) {
r, ok := req.(*PingQuery)
if !ok {
return common.Namespace{}, errInvalidRequestType
Expand Down
2 changes: 1 addition & 1 deletion go/common/grpc/wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func multiPingUnaryHandler(
Server: srv,
FullMethod: "/MultiPingService/Ping",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return srv.(MultiPingServer).Ping(ctx)
}
return interceptor(ctx, pq, info, handler)
Expand Down
10 changes: 5 additions & 5 deletions go/common/scheduling/fixed_rate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func TestFixedRateScheduler(t *testing.T) {
t.Run("No tasks", func(t *testing.T) {
t.Run("No tasks", func(_ *testing.T) {
scheduler := NewFixedRateScheduler(time.Millisecond, time.Millisecond)
scheduler.Start()
time.Sleep(5 * time.Millisecond)
Expand All @@ -20,8 +20,8 @@ func TestFixedRateScheduler(t *testing.T) {
require := require.New(t)

n1, n2 := 0, 0
t1 := func(ctx context.Context) error { n1++; return nil }
t2 := func(ctx context.Context) error { n2++; return nil }
t1 := func(_ context.Context) error { n1++; return nil }
t2 := func(_ context.Context) error { n2++; return nil }

scheduler := NewFixedRateScheduler(time.Millisecond, time.Millisecond)
scheduler.AddTask("t1", t1)
Expand All @@ -40,8 +40,8 @@ func TestFixedRateScheduler(t *testing.T) {
require := require.New(t)

n1, n2 := 0, 0
t1 := func(ctx context.Context) error { n1++; return nil }
t2 := func(ctx context.Context) error { n2++; return nil }
t1 := func(_ context.Context) error { n1++; return nil }
t2 := func(_ context.Context) error { n2++; return nil }

scheduler := NewFixedRateScheduler(time.Millisecond, time.Millisecond)
scheduler.AddTask("t1", t1)
Expand Down
1 change: 1 addition & 0 deletions go/common/sgx/fortanix_dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func UnsafeFortanixDummyKey() *rsa.PrivateKey {
// program) will be ignored and mercilessly mocked.
//
// Source: https://github.com/fortanix/rust-sgx/blob/master/enclave-runner/src/dummy.key
// nolint: gosec
const fortanixDummyPrivateKeyPEM = `
-----BEGIN RSA PRIVATE KEY-----
MIIG4gIBAAKCAYEAsbAX4s+7kHIpH+ZVBKtdefCfMacpgQL72og5r4hKoj0l5tyD
Expand Down
2 changes: 1 addition & 1 deletion go/common/sgx/pcs/quote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func FuzzQuoteUnmarshal(f *testing.F) {
f.Add(raw2)

// Fuzzing.
f.Fuzz(func(t *testing.T, data []byte) {
f.Fuzz(func(_ *testing.T, data []byte) {
var quote Quote
_ = quote.UnmarshalBinary(data)
})
Expand Down
2 changes: 1 addition & 1 deletion go/common/sync/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestOne(t *testing.T) {
noopFn := func(ctx context.Context) {}
noopFn := func(_ context.Context) {}
blockFn := func(ctx context.Context) {
<-ctx.Done()
}
Expand Down
10 changes: 5 additions & 5 deletions go/consensus/api/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ func handlerGetUnconfirmedTransactions(
Server: srv,
FullMethod: methodGetUnconfirmedTransactions.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return srv.(ClientBackend).GetUnconfirmedTransactions(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand Down Expand Up @@ -522,7 +522,7 @@ func handlerGetGenesisDocument(
Server: srv,
FullMethod: methodGetGenesisDocument.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return srv.(ClientBackend).GetGenesisDocument(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand All @@ -541,7 +541,7 @@ func handlerGetChainContext(
Server: srv,
FullMethod: methodGetChainContext.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return srv.(ClientBackend).GetChainContext(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand All @@ -560,7 +560,7 @@ func handlerGetStatus(
Server: srv,
FullMethod: methodGetStatus.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return srv.(ClientBackend).GetStatus(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand All @@ -579,7 +579,7 @@ func handlerGetNextBlockState(
Server: srv,
FullMethod: methodGetNextBlockState.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return srv.(ClientBackend).GetNextBlockState(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand Down
2 changes: 1 addition & 1 deletion go/consensus/cometbft/abci/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ func newApplicationState(ctx context.Context, upgrader upgrade.Backend, cfg *App
Name: "consensus",
CheckInterval: cfg.CheckpointerCheckInterval,
RootsPerVersion: 1,
GetParameters: func(ctx context.Context) (*checkpoint.CreationParameters, error) {
GetParameters: func(_ context.Context) (*checkpoint.CreationParameters, error) {
params := s.ConsensusParameters()
return &checkpoint.CreationParameters{
Interval: params.StateCheckpointInterval,
Expand Down
2 changes: 1 addition & 1 deletion go/consensus/cometbft/full/full.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ func (t *fullService) lazyInit() error { // nolint: gocyclo
t.failMonitor = newFailMonitor(t.ctx, t.Logger, t.node.ConsensusState().Wait)

// Register a halt hook that handles upgrades gracefully.
t.RegisterHaltHook(func(ctx context.Context, blockHeight int64, epoch beaconAPI.EpochTime, err error) {
t.RegisterHaltHook(func(_ context.Context, _ int64, _ beaconAPI.EpochTime, err error) {
if !errors.Is(err, upgradeAPI.ErrStopForUpgrade) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion go/consensus/p2p/light/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const (

func init() {
peermgmt.RegisterNodeHandler(&peermgmt.NodeHandlerBundle{
ProtocolsFn: func(n *node.Node, chainContext string) []core.ProtocolID {
ProtocolsFn: func(_ *node.Node, chainContext string) []core.ProtocolID {
return []core.ProtocolID{ProtocolID(chainContext)}
},
})
Expand Down
10 changes: 5 additions & 5 deletions go/control/api/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func handlerWaitSync(
Server: srv,
FullMethod: methodWaitSync.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return nil, srv.(NodeController).WaitSync(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand All @@ -127,7 +127,7 @@ func handlerIsSynced(
Server: srv,
FullMethod: methodIsSynced.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return srv.(NodeController).IsSynced(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand All @@ -146,7 +146,7 @@ func handlerWaitReady(
Server: srv,
FullMethod: methodWaitReady.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return nil, srv.(NodeController).WaitReady(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand All @@ -165,7 +165,7 @@ func handlerIsReady(
Server: srv,
FullMethod: methodIsSynced.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return srv.(NodeController).IsReady(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand Down Expand Up @@ -230,7 +230,7 @@ func handlerGetStatus(
Server: srv,
FullMethod: methodGetStatus.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
handler := func(ctx context.Context, _ interface{}) (interface{}, error) {
return srv.(NodeController).GetStatus(ctx)
}
return interceptor(ctx, nil, info, handler)
Expand Down
2 changes: 1 addition & 1 deletion go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,4 @@ require (
lukechampine.com/blake3 v1.2.1 // indirect
)

go 1.21
go 1.22
Loading

0 comments on commit 91855c3

Please sign in to comment.