Some more code cleanup.
This commit is contained in:
parent
665944b444
commit
ed2cd8b81c
|
@ -9,6 +9,8 @@ import (
|
|||
"io"
|
||||
)
|
||||
|
||||
var newline = []byte{'\n'}
|
||||
|
||||
type GoWriter struct {
|
||||
io.Writer
|
||||
c int
|
||||
|
@ -21,7 +23,7 @@ func (w *GoWriter) Write(p []byte) (n int, err error) {
|
|||
|
||||
for n = range p {
|
||||
if w.c%12 == 0 {
|
||||
w.Writer.Write([]byte{'\n'})
|
||||
w.Writer.Write(newline)
|
||||
w.c = 0
|
||||
}
|
||||
|
||||
|
|
6
main.go
6
main.go
|
@ -74,8 +74,9 @@ func main() {
|
|||
if pipe {
|
||||
// Can't infer from input file name in this mode.
|
||||
fmt.Fprintln(os.Stderr, "[e] No function name specified.")
|
||||
os.Exit(1)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
_, file := path.Split(*in)
|
||||
file = strings.ToLower(file)
|
||||
file = strings.Replace(file, " ", "_", -1)
|
||||
|
@ -90,7 +91,6 @@ func main() {
|
|||
fmt.Fprintf(os.Stderr, "[w] No function name specified. Using '%s'.\n", file)
|
||||
*funcname = file
|
||||
}
|
||||
}
|
||||
|
||||
// Read the input file, transform it into a gzip compressed data stream and
|
||||
// write it out as a go source file.
|
||||
|
|
Loading…
Reference in New Issue
Block a user