Skip to content

Commit

Permalink
(#29) Fixed distribute bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hahwul committed Jul 23, 2021
1 parent eb4d930 commit a625dd9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/gee/gee.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// Gee is running gee
func Gee(options model.Options) {
if options.Debug {
printing.DebugMsg("MSG","Starting gee")
printing.DebugMsg("MSG", "Starting gee")
}
sc := bufio.NewScanner(os.Stdin)
mode := os.O_CREATE | os.O_WRONLY
Expand All @@ -29,7 +29,7 @@ func Gee(options model.Options) {
for _, filename := range options.Files {
f, err := os.OpenFile(filename, mode, 0644)
if err != nil && options.Debug {
printing.DebugMsg("ERROR",err)
printing.DebugMsg("ERROR", err)
} else {
files = append(files, f)
}
Expand Down Expand Up @@ -57,7 +57,7 @@ func Gee(options model.Options) {
for _, filename := range options.Files {
f, err := os.OpenFile(filename+"_"+strconv.Itoa(stdPointer), mode, 0644)
if err != nil && options.Debug {
printing.DebugMsg("ERROR",err)
printing.DebugMsg("ERROR", err)
} else {
files = append(files, f)
}
Expand All @@ -72,6 +72,7 @@ func Gee(options model.Options) {
} else {
distributePointer = 0
WriteFile(files[distributePointer], line, options)
distributePointer = distributePointer + 1
}
} else {
for _, k := range files {
Expand All @@ -86,6 +87,6 @@ func Gee(options model.Options) {
// Graceful shutdown
ClosedFiles(files)
if options.Debug {
printing.DebugMsg("MSG","Finish gee, graceful shutdown...")
printing.DebugMsg("MSG", "Finish gee, graceful shutdown...")
}
}

0 comments on commit a625dd9

Please sign in to comment.