Skip to content

Commit

Permalink
fix(CI): Change CI Go version to 1.20
Browse files Browse the repository at this point in the history
Signed-off-by: Minh Huy Tran <[email protected]>
  • Loading branch information
NhoxxKienn committed Feb 16, 2024
1 parent 71e1868 commit dbb1b64
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
release:

env:
go-version: 1.17
go-version: ´1.20´

jobs:
check-copyright:
Expand Down
4 changes: 2 additions & 2 deletions channel/test/app_randomizer_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ func TestAppRandomizerSet(t *testing.T) {
assert.NotNil(t, appRandomizer, "appRandomizer should be default initialized")
assert.False(t, isAppRandomizerSet, "isAppRandomizerSet should be defaulted to false")

old := appRandomizer
// old := appRandomizer
assert.NotPanics(t, func() { SetAppRandomizer(&MockAppRandomizer{}) }, "first SetAppRandomizer() should work")
assert.True(t, isAppRandomizerSet, "isAppRandomizerSet should be true")
assert.NotNil(t, appRandomizer, "appRandomizer should not be nil")
// assert.False(t, old == appRandomizer, "appRandomizer should have changed")

old = appRandomizer
old := appRandomizer
assert.Panics(t, func() { SetAppRandomizer(&MockAppRandomizer{}) }, "second SetAppRandomizer() should panic")
assert.True(t, isAppRandomizerSet, "isAppRandomizerSet should be true")
assert.NotNil(t, appRandomizer, "appRandomizer should not be nil")
Expand Down
2 changes: 1 addition & 1 deletion client/adjudicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (c *Channel) Settle(ctx context.Context) (err error) {
// Withdraw.
err = c.withdraw(ctx)
if err != nil {
return
return err
}

// Set phase `Withdrawn`.
Expand Down
2 changes: 1 addition & 1 deletion client/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func (c *Client) validTwoPartyProposal(
multiLedger := multi.IsMultiLedgerAssets(proposal.Base().InitBals.Assets)
appChannel := !channel.IsNoApp(proposal.Base().App)
if multiLedger && appChannel {
return fmt.Errorf("multi-ledger app channel not supported")
return errors.New("multi-ledger app channel not supported")
}

peers := c.proposalPeers(proposal)
Expand Down
6 changes: 4 additions & 2 deletions client/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ func (c *Client) handleSyncMsg(peer wire.Address, msg *ChannelSyncMsg) {

// syncChannel synchronizes the channel state with the given peer and modifies
// the current state if required.
// nolint:unused
//
//nolint:unused
func (c *Client) syncChannel(ctx context.Context, ch *persistence.Channel, p wire.Address) (err error) {
recv := wire.NewReceiver()
defer recv.Close() // ignore error
Expand Down Expand Up @@ -117,7 +118,8 @@ func (c *Client) syncChannel(ctx context.Context, ch *persistence.Channel, p wir
}

// validateMessage validates the remote channel sync message.
// nolint:unused, nestif
//
//nolint:unused, nestif
func validateMessage(ch *persistence.Channel, msg *ChannelSyncMsg) error {
v := ch.CurrentTX().Version
mv := msg.CurrentTX.Version
Expand Down
2 changes: 1 addition & 1 deletion client/virtual_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func (c *Client) matchFundingProposal(ctx context.Context, a, b interface{}) boo
}

go func() {
err := virtual.watchVirtual() //nolint:contextcheck // The context will be derived from the channel context.
err := virtual.watchVirtual() // The context will be derived from the channel context.
c.log.Debugf("channel %v: watcher stopped: %v", virtual.ID(), err)
}()
return true
Expand Down
4 changes: 2 additions & 2 deletions wallet/test/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func TestAddress(t *testing.T, s *Setup) { //nolint:revive // `test.Test...` stu
// Test Address.String.
nullString := null.String()
addrString := addr.String()
assert.Greater(t, len(nullString), 0)
assert.Greater(t, len(addrString), 0)
assert.NotEmpty(t, len(nullString), 0)
assert.NotEmpty(t, len(addrString), 0)
assert.NotEqual(t, addrString, nullString)

// Test Address.Equals.
Expand Down
2 changes: 1 addition & 1 deletion wallet/test/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestAccountWithWalletAndBackend(t *testing.T, s *Setup) { //nolint:revive /
t.Error("Verification of invalid signature should produce error or return false")
}
// Expand the signature and check for error
// nolint:gocritic
//nolint:gocritic
tampered = append(sig, 0)
valid, err = s.Backend.VerifySignature(s.DataToSign, tampered, acc.Address())
if valid && err != nil {
Expand Down
6 changes: 3 additions & 3 deletions wallet/test/walletbench.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func GenericAccountBenchmark(b *testing.B, s *Setup) {
func benchAccountSign(b *testing.B, s *Setup) {
b.Helper()
perunAcc, err := s.Wallet.Unlock(s.AddressInWallet)
require.Nil(b, err)
require.NoError(b, err)

for n := 0; n < b.N; n++ {
_, err := perunAcc.SignData(s.DataToSign)
Expand All @@ -56,9 +56,9 @@ func benchBackendVerifySig(b *testing.B, s *Setup) {
// We dont want to measure the SignDataWithPW here, just need it for the verification
b.StopTimer()
perunAcc, err := s.Wallet.Unlock(s.AddressInWallet)
require.Nil(b, err)
require.NoError(b, err)
signature, err := perunAcc.SignData(s.DataToSign)
require.Nil(b, err)
require.NoError(b, err)
b.StartTimer()

for n := 0; n < b.N; n++ {
Expand Down
2 changes: 1 addition & 1 deletion wire/cache_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestCache(t *testing.T) {
assert.Equal(2, c.Size())

empty := c.Messages(func(*Envelope) bool { return false })
assert.Len(empty, 0)
assert.Empty(empty, 0)

c.Release(&isPing)
assert.False(c.Put(ping2), "Put into cache with canceled predicate")
Expand Down
9 changes: 0 additions & 9 deletions wire/net/simple/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,11 @@
package simple

import (
"math/rand"

"perun.network/go-perun/wire"
"perun.network/go-perun/wire/test"
)

func init() {
wire.SetNewAddressFunc(func() wire.Address {
return NewAddress("")
})
test.SetNewRandomAddress(func(rng *rand.Rand) wire.Address {
return NewRandomAddress(rng)
})
test.SetNewRandomAccount(func(rng *rand.Rand) wire.Account {
return NewRandomAccount(rng)
})
}
2 changes: 1 addition & 1 deletion wire/net/simple/simple_exchange_addr_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestExchangeAddrs_Timeout(t *testing.T) {

ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
ctxtest.AssertTerminates(t, 2*timeout, func() {
ctxtest.AssertTerminates(t, 20*timeout, func() {
addr, err := wirenet.ExchangeAddrsPassive(ctx, NewRandomAccount(rng), a)
assert.Nil(t, addr)
assert.Error(t, err)
Expand Down
2 changes: 1 addition & 1 deletion wire/perunio/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func encodeString(w io.Writer, s string) error {
return errors.Wrap(err, "failed to write string")
}

// decodeString reads the length as uint16 and the the string itself from the io.Reader.
// decodeString reads the length as uint16 and the string itself from the io.Reader.
func decodeString(r io.Reader, s *string) error {
var l uint16
if err := binary.Read(r, byteOrder, &l); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion wire/perunio/string_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestEncodeDecodeString(t *testing.T) {
})

t.Run("too long string", func(t *testing.T) {
tooLong := string(append(uint16buf, 42)) // nolint: makezero
tooLong := string(append(uint16buf, 42)) //nolint: makezero
var buf bytes.Buffer
assert.Error(encodeString(&buf, tooLong))
assert.Zero(buf.Len(), "nothing should have been written to the stream")
Expand Down
2 changes: 1 addition & 1 deletion wire/perunio/wire_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestEncodeDecode(t *testing.T) {
}

go func() {
a.Nil(Encode(w, values...), "failed to encode values")
a.NoError(Encode(w, values...), "failed to encode values")
}()

d := make([]interface{}, len(values))
Expand Down

0 comments on commit dbb1b64

Please sign in to comment.