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