Skip to content

Commit 351cd49

Browse files
go1.19 gofmt (erigontech#4988)
1 parent 0beb295 commit 351cd49

File tree

163 files changed

+750
-648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+750
-648
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
if: runner.os == 'Linux'
6161
uses: golangci/golangci-lint-action@v3
6262
with:
63-
version: v1.47
63+
version: v1.48
6464

6565
- name: Test
6666
run: make test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ lintci:
155155
## lintci-deps: (re)installs golangci-lint to build/bin/golangci-lint
156156
lintci-deps:
157157
rm -f ./build/bin/golangci-lint
158-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.47.2
158+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.48.0
159159

160160
## clean: cleans the go cache, build dir, libmdbx db dir
161161
clean:

accounts/abi/abi_test.go

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
16+
//
1617
//nolint:scopelint
1718
package abi
1819

@@ -165,8 +166,9 @@ func TestInvalidABI(t *testing.T) {
165166

166167
// TestConstructor tests a constructor function.
167168
// The test is based on the following contract:
168-
// contract TestConstructor {
169-
// constructor(uint256 a, uint256 b) public{}
169+
//
170+
// contract TestConstructor {
171+
// constructor(uint256 a, uint256 b) public{}
170172
// }
171173
func TestConstructor(t *testing.T) {
172174
json := `[{ "inputs": [{"internalType": "uint256","name": "a","type": "uint256" },{ "internalType": "uint256","name": "b","type": "uint256"}],"stateMutability": "nonpayable","type": "constructor"}]`
@@ -710,16 +712,19 @@ func TestBareEvents(t *testing.T) {
710712
}
711713

712714
// TestUnpackEvent is based on this contract:
713-
// contract T {
714-
// event received(address sender, uint amount, bytes memo);
715-
// event receivedAddr(address sender);
716-
// function receive(bytes memo) external payable {
717-
// received(msg.sender, msg.value, memo);
718-
// receivedAddr(msg.sender);
719-
// }
720-
// }
715+
//
716+
// contract T {
717+
// event received(address sender, uint amount, bytes memo);
718+
// event receivedAddr(address sender);
719+
// function receive(bytes memo) external payable {
720+
// received(msg.sender, msg.value, memo);
721+
// receivedAddr(msg.sender);
722+
// }
723+
// }
724+
//
721725
// When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt:
722-
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
726+
//
727+
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
723728
func TestUnpackEvent(t *testing.T) {
724729
const abiJSON = `[{"constant":false,"inputs":[{"name":"memo","type":"bytes"}],"name":"receive","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"memo","type":"bytes"}],"name":"received","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"}],"name":"receivedAddr","type":"event"}]`
725730
abi, err := JSON(strings.NewReader(abiJSON))
@@ -1064,8 +1069,9 @@ func TestDoubleDuplicateMethodNames(t *testing.T) {
10641069
// TestDoubleDuplicateEventNames checks that if send0 already exists, there won't be a name
10651070
// conflict and that the second send event will be renamed send1.
10661071
// The test runs the abi of the following contract.
1067-
// contract DuplicateEvent {
1068-
// event send(uint256 a);
1072+
//
1073+
// contract DuplicateEvent {
1074+
// event send(uint256 a);
10691075
// event send0();
10701076
// event send();
10711077
// }
@@ -1092,7 +1098,8 @@ func TestDoubleDuplicateEventNames(t *testing.T) {
10921098
// TestUnnamedEventParam checks that an event with unnamed parameters is
10931099
// correctly handled.
10941100
// The test runs the abi of the following contract.
1095-
// contract TestEvent {
1101+
//
1102+
// contract TestEvent {
10961103
// event send(uint256, uint256);
10971104
// }
10981105
func TestUnnamedEventParam(t *testing.T) {

accounts/abi/bind/backends/simulated_test.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,17 @@ func TestSimulatedBackend(t *testing.T) {
9494

9595
var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
9696

97-
// the following is based on this contract:
98-
// contract T {
99-
// event received(address sender, uint amount, bytes memo);
100-
// event receivedAddr(address sender);
97+
// the following is based on this contract:
98+
// contract T {
99+
// event received(address sender, uint amount, bytes memo);
100+
// event receivedAddr(address sender);
101101
//
102-
// function receive(bytes calldata memo) external payable returns (string memory res) {
103-
// emit received(msg.sender, msg.value, memo);
104-
// emit receivedAddr(msg.sender);
105-
// return "hello world";
106-
// }
107-
// }
102+
// function receive(bytes calldata memo) external payable returns (string memory res) {
103+
// emit received(msg.sender, msg.value, memo);
104+
// emit receivedAddr(msg.sender);
105+
// return "hello world";
106+
// }
107+
// }
108108
const abiJSON = `[ { "constant": false, "inputs": [ { "name": "memo", "type": "bytes" } ], "name": "receive", "outputs": [ { "name": "res", "type": "string" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "sender", "type": "address" }, { "indexed": false, "name": "amount", "type": "uint256" }, { "indexed": false, "name": "memo", "type": "bytes" } ], "name": "received", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "sender", "type": "address" } ], "name": "receivedAddr", "type": "event" } ]`
109109
const abiBin = `0x608060405234801561001057600080fd5b506102a0806100206000396000f3fe60806040526004361061003b576000357c010000000000000000000000000000000000000000000000000000000090048063a69b6ed014610040575b600080fd5b6100b76004803603602081101561005657600080fd5b810190808035906020019064010000000081111561007357600080fd5b82018360208201111561008557600080fd5b803590602001918460018302840111640100000000831117156100a757600080fd5b9091929391929390505050610132565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f75780820151818401526020810190506100dc565b50505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60607f75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed33348585604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509550505050505060405180910390a17f46923992397eac56cf13058aced2a1871933622717e27b24eabc13bf9dd329c833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a16040805190810160405280600b81526020017f68656c6c6f20776f726c6400000000000000000000000000000000000000000081525090509291505056fea165627a7a72305820ff0c57dad254cfeda48c9cfb47f1353a558bccb4d1bc31da1dae69315772d29e0029`
110110
const deployedCode = `60806040526004361061003b576000357c010000000000000000000000000000000000000000000000000000000090048063a69b6ed014610040575b600080fd5b6100b76004803603602081101561005657600080fd5b810190808035906020019064010000000081111561007357600080fd5b82018360208201111561008557600080fd5b803590602001918460018302840111640100000000831117156100a757600080fd5b9091929391929390505050610132565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f75780820151818401526020810190506100dc565b50505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60607f75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed33348585604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509550505050505060405180910390a17f46923992397eac56cf13058aced2a1871933622717e27b24eabc13bf9dd329c833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a16040805190810160405280600b81526020017f68656c6c6f20776f726c6400000000000000000000000000000000000000000081525090509291505056fea165627a7a72305820ff0c57dad254cfeda48c9cfb47f1353a558bccb4d1bc31da1dae69315772d29e0029`
@@ -954,7 +954,8 @@ func TestSimulatedBackend_CodeAt(t *testing.T) {
954954
}
955955

956956
// When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt:
957-
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
957+
//
958+
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
958959
func TestSimulatedBackend_PendingAndCallContract(t *testing.T) {
959960
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
960961
sim := simTestBackend(t, testAddr)

accounts/abi/pack_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
16+
//
1617
//nolint:scopelint
1718
package abi
1819

accounts/abi/reflect.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ import (
2828
// given type
2929
// e.g. turn
3030
// var fields []reflect.StructField
31-
// fields = append(fields, reflect.StructField{
32-
// Name: "X",
33-
// Type: reflect.TypeOf(new(big.Int)),
34-
// Tag: reflect.StructTag("json:\"" + "x" + "\""),
35-
// }
31+
//
32+
// fields = append(fields, reflect.StructField{
33+
// Name: "X",
34+
// Type: reflect.TypeOf(new(big.Int)),
35+
// Tag: reflect.StructTag("json:\"" + "x" + "\""),
36+
// }
37+
//
3638
// into
3739
// type TupleT struct { X *big.Int }
3840
func ConvertType(in interface{}, proto interface{}) interface{} {
@@ -178,10 +180,14 @@ func setStruct(dst, src reflect.Value) error {
178180

179181
// mapArgNamesToStructFields maps a slice of argument names to struct fields.
180182
// first round: for each Exportable field that contains a `abi:""` tag
181-
// and this field name exists in the given argument name list, pair them together.
183+
//
184+
// and this field name exists in the given argument name list, pair them together.
185+
//
182186
// second round: for each argument name that has not been already linked,
183-
// find what variable is expected to be mapped into, if it exists and has not been
184-
// used, pair them.
187+
//
188+
// find what variable is expected to be mapped into, if it exists and has not been
189+
// used, pair them.
190+
//
185191
// Note this function assumes the given value is a struct value.
186192
func mapArgNamesToStructFields(argNames []string, value reflect.Value) (map[string]string, error) {
187193
typ := value.Type()

accounts/abi/unpack_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
16+
//
1617
//nolint:scopelint
1718
package abi
1819

cmd/bootnode/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ import (
2121
"crypto/ecdsa"
2222
"flag"
2323
"fmt"
24-
"github.com/ledgerwatch/erigon-lib/common"
2524
"net"
2625
"os"
2726

27+
"github.com/ledgerwatch/erigon-lib/common"
28+
2829
"github.com/ledgerwatch/erigon/cmd/utils"
2930
"github.com/ledgerwatch/erigon/crypto"
3031
"github.com/ledgerwatch/erigon/p2p/discover"

cmd/devnettest/commands/all.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package commands
22

33
import (
44
"fmt"
5+
56
"github.com/spf13/cobra"
67
)
78

cmd/devnettest/commands/event.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package commands
22

33
import (
44
"fmt"
5+
"sync"
6+
57
"github.com/ledgerwatch/erigon/cmd/devnettest/services"
68
"github.com/spf13/cobra"
7-
"sync"
89
)
910

1011
var (

0 commit comments

Comments
 (0)