A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/orgrim/pg_back/commit/b4c9f6171142482f6af55feba96cce8ecff8c532 below:

Replace for loop with counter by range · orgrim/pg_back@b4c9f61 · GitHub

@@ -356,8 +356,8 @@ func run() (retVal error) {

356 356 357 357

// start workers - thanks gobyexample.com

358 358

l.Verbosef("launching %d workers", maxWorkers)

359 -

for w := 0; w < maxWorkers; w++ {

360 -

go dumper(w, jobs, results, producedFiles)

359 +

for range maxWorkers {

360 +

go dumper(jobs, results, producedFiles)

361 361

}

362 362 363 363

defDbOpts := defaultDbOpts(opts)

@@ -404,7 +404,7 @@ func run() (retVal error) {

404 404

}

405 405 406 406

// collect the result of the jobs

407 -

for j := 0; j < numJobs; j++ {

407 +

for range numJobs {

408 408

var b, c string

409 409

var err error

410 410

@@ -754,7 +754,7 @@ func (d *dump) dump(fc chan<- sumFileJob) error {

754 754

return nil

755 755

}

756 756 757 -

func dumper(id int, jobs <-chan *dump, results chan<- *dump, fc chan<- sumFileJob) {

757 +

func dumper(jobs <-chan *dump, results chan<- *dump, fc chan<- sumFileJob) {

758 758

for j := range jobs {

759 759 760 760

if err := j.dump(fc); err != nil {

@@ -1138,7 +1138,7 @@ func decryptDirectory(dir string, params decryptParams, workers int, globs []str

1138 1138 1139 1139

// Start workers that listen for filenames to decrypt until the queue

1140 1140

// is closed

1141 -

for i := 0; i < workers; i++ {

1141 +

for i := range workers {

1142 1142

wg.Add(1)

1143 1143

go func(id int) {

1144 1144

l.Verboseln("started decrypt worker", id)

@@ -1324,7 +1324,7 @@ func postProcessFiles(inFiles chan sumFileJob, wg *sync.WaitGroup, opts options)

1324 1324

encIn := make(chan encryptFileJob)

1325 1325

uploadIn := make(chan uploadJob)

1326 1326 1327 -

for i := 0; i < opts.Jobs; i++ {

1327 +

for i := range opts.Jobs {

1328 1328

wg.Add(1)

1329 1329

go func(id int) {

1330 1330

l.Verboseln("started checksum worker", id)

@@ -1427,7 +1427,7 @@ func postProcessFiles(inFiles chan sumFileJob, wg *sync.WaitGroup, opts options)

1427 1427 1428 1428

sumEncIn := make(chan sumEncryptFileJob)

1429 1429 1430 -

for i := 0; i < opts.Jobs; i++ {

1430 +

for i := range opts.Jobs {

1431 1431

wg.Add(1)

1432 1432

go func(id int) {

1433 1433

l.Verboseln("started encryption worker", id)

@@ -1473,7 +1473,7 @@ func postProcessFiles(inFiles chan sumFileJob, wg *sync.WaitGroup, opts options)

1473 1473

}(i)

1474 1474

}

1475 1475 1476 -

for i := 0; i < opts.Jobs; i++ {

1476 +

for i := range opts.Jobs {

1477 1477

wg.Add(1)

1478 1478

go func(id int) {

1479 1479

l.Verboseln("started checksum worker for encrypted files", id)

@@ -1521,7 +1521,7 @@ func postProcessFiles(inFiles chan sumFileJob, wg *sync.WaitGroup, opts options)

1521 1521

repo = nil

1522 1522

}

1523 1523 1524 -

for i := 0; i < opts.Jobs; i++ {

1524 +

for i := range opts.Jobs {

1525 1525

wg.Add(1)

1526 1526

go func(id int) {

1527 1527

l.Verboseln("started upload worker", id)

@@ -1557,22 +1557,22 @@ func postProcessFiles(inFiles chan sumFileJob, wg *sync.WaitGroup, opts options)

1557 1557

// inFiles will be closed outside of the function, when all

1558 1558

// worker reading from it exit, close encIn to make the workers

1559 1559

// reading from it stop, and so on.

1560 -

for i := 0; i < opts.Jobs; i++ {

1560 +

for range opts.Jobs {

1561 1561

<-done

1562 1562

}

1563 1563

close(encIn)

1564 1564 1565 -

for i := 0; i < opts.Jobs; i++ {

1565 +

for range opts.Jobs {

1566 1566

<-done

1567 1567

}

1568 1568

close(sumEncIn)

1569 1569 1570 -

for i := 0; i < opts.Jobs; i++ {

1570 +

for range opts.Jobs {

1571 1571

<-done

1572 1572

}

1573 1573

close(uploadIn)

1574 1574 1575 -

for i := 0; i < opts.Jobs; i++ {

1575 +

for range opts.Jobs {

1576 1576

<-done

1577 1577

}

1578 1578

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4