Clean house
This commit is contained in:
2
main.go
2
main.go
@@ -32,7 +32,7 @@ func main() {
|
|||||||
|
|
||||||
if *debug {
|
if *debug {
|
||||||
log.SetFlags(log.Lmicroseconds | log.Lshortfile)
|
log.SetFlags(log.Lmicroseconds | log.Lshortfile)
|
||||||
logFile, err := os.Create("main.log")
|
logFile, err := os.Create("cln.log")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error creating log file: %v", err)
|
log.Printf("Error creating log file: %v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
12
sync.yaml
12
sync.yaml
@@ -1,10 +1,2 @@
|
|||||||
- source: main.go
|
- source: *
|
||||||
target: test/main.go
|
target: test/
|
||||||
|
|
||||||
- source: README.md
|
|
||||||
target: test/README.md
|
|
||||||
|
|
||||||
- source: sync.yaml
|
|
||||||
target: test/sync.yaml
|
|
||||||
|
|
||||||
|
|
8
util.go
8
util.go
@@ -104,7 +104,7 @@ func GetSyncFilesRecursively(input string, output chan string, status chan error
|
|||||||
dirCount)
|
dirCount)
|
||||||
case <-done:
|
case <-done:
|
||||||
// Final progress update
|
// Final progress update
|
||||||
fmt.Printf("\rFiles processed: %d; Folders processed: %d; Completed successfully\n",
|
fmt.Printf("\nFiles processed: %d; Folders processed: %d; Completed successfully\n",
|
||||||
atomic.LoadInt32(&filesProcessed),
|
atomic.LoadInt32(&filesProcessed),
|
||||||
atomic.LoadInt32(&foldersProcessed))
|
atomic.LoadInt32(&foldersProcessed))
|
||||||
return
|
return
|
||||||
@@ -115,6 +115,8 @@ func GetSyncFilesRecursively(input string, output chan string, status chan error
|
|||||||
allDone := make(chan struct{})
|
allDone := make(chan struct{})
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
// WTF is this waitgroup?
|
||||||
|
// Nowhere is it added...
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
@@ -126,7 +128,7 @@ func GetSyncFilesRecursively(input string, output chan string, status chan error
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
time.Sleep(50 * time.Millisecond)
|
time.Sleep(50 * time.Millisecond)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -171,7 +173,7 @@ func processDirectory(directory string, directories chan<- string, output chan<-
|
|||||||
if file.IsDir() {
|
if file.IsDir() {
|
||||||
directories <- filepath.Join(directory, file.Name())
|
directories <- filepath.Join(directory, file.Name())
|
||||||
} else {
|
} else {
|
||||||
if FileRegex.MatchString(file.Name()) || IsYAMLSyncFile(file.Name()) {
|
if IsYAMLSyncFile(file.Name()) {
|
||||||
output <- filepath.Join(directory, file.Name())
|
output <- filepath.Join(directory, file.Name())
|
||||||
}
|
}
|
||||||
atomic.AddInt32(filesProcessed, 1)
|
atomic.AddInt32(filesProcessed, 1)
|
||||||
|
Reference in New Issue
Block a user