Permalink
Browse files

use bufio.Writer

  • Loading branch information...
1 parent 62e9c87 commit c7b84b9ec208fa5307dc7cda8d307d1a875cec72 @haya14busa committed Nov 30, 2016
Showing with 5 additions and 1 deletion.
  1. +5 −1 cmd/gopkgs/main.go
View
@@ -1,6 +1,7 @@
package main
import (
+ "bufio"
"flag"
"fmt"
"os"
@@ -21,13 +22,16 @@ func main() {
os.Exit(2)
}
+ w := bufio.NewWriter(os.Stdout)
+ defer w.Flush()
+
for _, pkg := range imports.GoPath() {
out := pkg.ImportPath
if *fullpath {
out = pkg.Dir
} else if *short {
out = pkg.ImportPathShort
}
- fmt.Println(out)
+ fmt.Fprintln(w, out)
}
}

0 comments on commit c7b84b9

Please sign in to comment.