worker_pool

command module
v0.0.0-...-68235f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2022 License: MIT Imports: 7 Imported by: 0

README

Padrão Worker Pool em Golang

GitHub

Como Funciona

Algoritmo Utiliza o padrão worker pool do golang para criptografar arquivos
Usando função recursiva para pegar os caminhos
func getPath(path string) []string {
   var paths []string
   files, err := ioutil.ReadDir(path)
   if err != nil {
       log.Fatal(err)
   }
 
   for _, f := range files {
 
       if f.IsDir() {
           path := fmt.Sprintf("%s/%s", path, f.Name())
           re := getPath(path)
           paths = append(paths, re...)
       } else {
           //fmt.Println(fmt.Sprintf("%s\\%s", path, f.Name()))
           paths = append(paths, fmt.Sprintf("%s/%s", path, f.Name()))
       }
 
   }
 
   return paths
}

Como Utilizar em seu exemplo

Set a variavel path_default := "./teste"
go run main.go 

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL