1
0
mirror of https://github.com/tmrts/go-patterns.git synced 2024-11-25 14:36:06 +03:00

concurrency/bounded_parallelism: replace deprecated method: updated [ioutil] to [os]

This commit is contained in:
jongyunha 2024-09-02 16:21:14 +09:00
parent f978e42036
commit e8758395c1

View File

@ -4,7 +4,6 @@ import (
"crypto/md5" "crypto/md5"
"errors" "errors"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"sort" "sort"
@ -50,7 +49,7 @@ type result struct {
// files on c until either paths or done is closed. // files on c until either paths or done is closed.
func digester(done <-chan struct{}, paths <-chan string, c chan<- result) { func digester(done <-chan struct{}, paths <-chan string, c chan<- result) {
for path := range paths { // HLpaths for path := range paths { // HLpaths
data, err := ioutil.ReadFile(path) data, err := os.ReadFile(path)
select { select {
case c <- result{path, md5.Sum(data), err}: case c <- result{path, md5.Sum(data), err}:
case <-done: case <-done: