mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
all: not copy loop var for golang v1.22 (#1020)
This commit is contained in:
parent
d955e17cd6
commit
d25c6f02a7
12 changed files with 0 additions and 14 deletions
|
|
@ -489,7 +489,6 @@ func (d *Downloader) spawnSync(fetchers []func() error) error {
|
|||
errc := make(chan error, len(fetchers))
|
||||
d.cancelWg.Add(len(fetchers))
|
||||
for _, fn := range fetchers {
|
||||
fn := fn
|
||||
go func() { defer d.cancelWg.Done(); errc <- fn() }()
|
||||
}
|
||||
// Wait for the first error, then terminate the others.
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@ func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, ne
|
|||
continue
|
||||
}
|
||||
// Compatible; initialise the sub-protocol
|
||||
version := version // Closure for the run
|
||||
manager.SubProtocols = append(manager.SubProtocols, p2p.Protocol{
|
||||
Name: ProtocolName,
|
||||
Version: version,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) {
|
|||
if !strings.HasSuffix(file.Name(), ".json") {
|
||||
continue
|
||||
}
|
||||
file := file // capture range variable
|
||||
t.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
@ -180,7 +179,6 @@ func BenchmarkTracers(b *testing.B) {
|
|||
if !strings.HasSuffix(file.Name(), ".json") {
|
||||
continue
|
||||
}
|
||||
file := file // capture range variable
|
||||
b.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(b *testing.B) {
|
||||
blob, err := os.ReadFile(filepath.Join("..", "testdata", "call_tracer", file.Name()))
|
||||
if err != nil {
|
||||
|
|
@ -259,7 +257,6 @@ func testContractTracer(tracerName string, dirPath string, t *testing.T) {
|
|||
if !strings.HasSuffix(file.Name(), ".json") {
|
||||
continue
|
||||
}
|
||||
file := file // capture range variable
|
||||
t.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
|||
|
|
@ -244,7 +244,6 @@ func TestStartRPC(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
|||
|
|
@ -475,7 +475,6 @@ func TestNodeRPCPrefix(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
name := fmt.Sprintf("http=%s ws=%s", test.httpPrefix, test.wsPrefix)
|
||||
t.Run(name, func(t *testing.T) {
|
||||
cfg := &Config{
|
||||
|
|
|
|||
|
|
@ -507,7 +507,6 @@ func TestGzipHandler(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
srv := httptest.NewServer(newGzipHandler(test.handler))
|
||||
defer srv.Close()
|
||||
|
|
|
|||
|
|
@ -355,7 +355,6 @@ outer:
|
|||
func (p *Peer) startProtocols(writeStart <-chan struct{}, writeErr chan<- error) {
|
||||
p.wg.Add(len(p.running))
|
||||
for _, proto := range p.running {
|
||||
proto := proto
|
||||
proto.closed = p.closed
|
||||
proto.wstart = writeStart
|
||||
proto.werr = writeErr
|
||||
|
|
|
|||
|
|
@ -308,7 +308,6 @@ func TestStreamReadBytes(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
name := fmt.Sprintf("input_%s/size_%d", test.input, test.size)
|
||||
t.Run(name, func(t *testing.T) {
|
||||
s := NewStream(bytes.NewReader(unhex(test.input)), 0)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ var tests = []string{"uints", "nil", "rawvalue", "optional", "bigint", "uint256"
|
|||
|
||||
func TestOutput(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test, func(t *testing.T) {
|
||||
inputFile := filepath.Join("testdata", test+".in.txt")
|
||||
outputFile := filepath.Join("testdata", test+".out.txt")
|
||||
|
|
|
|||
|
|
@ -776,7 +776,6 @@ func TestClientHTTP(t *testing.T) {
|
|||
wantResult = echoResult{"a", 1, new(echoArgs)}
|
||||
)
|
||||
for i := range results {
|
||||
i := i
|
||||
go func() {
|
||||
errc <- client.Call(&results[i], "test_echo", wantResult.String, wantResult.Int, wantResult.Args)
|
||||
}()
|
||||
|
|
|
|||
|
|
@ -143,7 +143,6 @@ func TestBlockNumberOrHash_WithNumber_MarshalAndUnmarshal(t *testing.T) {
|
|||
{"finalized", int64(CommittedBlockNumber)},
|
||||
}
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
bnh := BlockNumberOrHashWithNumber(BlockNumber(test.number))
|
||||
marshalled, err := json.Marshal(bnh)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ func TestState(t *testing.T) {
|
|||
|
||||
st.walk(t, stateTestDir, func(t *testing.T, name string, test *StateTest) {
|
||||
for _, subtest := range test.Subtests() {
|
||||
subtest := subtest
|
||||
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
|
||||
name := name + "/" + key
|
||||
t.Run(key, func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue