diff --git a/gowriter.go b/gowriter.go index 0898683..551dd1f 100644 --- a/gowriter.go +++ b/gowriter.go @@ -14,19 +14,19 @@ type GoWriter struct { c int } -func (this *GoWriter) Write(p []byte) (n int, err error) { +func (w *GoWriter) Write(p []byte) (n int, err error) { if len(p) == 0 { return } for n = range p { - if this.c%12 == 0 { - this.Writer.Write([]byte{'\n'}) - this.c = 0 + if w.c%12 == 0 { + w.Writer.Write([]byte{'\n'}) + w.c = 0 } - fmt.Fprintf(this.Writer, "0x%02x,", p[n]) - this.c++ + fmt.Fprintf(w.Writer, "0x%02x,", p[n]) + w.c++ } return diff --git a/main.go b/main.go index ff84ce2..8ae9a22 100644 --- a/main.go +++ b/main.go @@ -5,12 +5,12 @@ package main import ( - "os" "flag" "fmt" + "os" "path" - "strings" "runtime" + "strings" "unicode" ) @@ -95,7 +95,6 @@ func main() { if pipe { if err = translate(os.Stdin, os.Stdout, *pkgname, *funcname); err != nil { fmt.Fprintf(os.Stderr, "[e] %s\n", err) - return } } else { var fs, fd *os.File diff --git a/testdata/gophercolor.png.go b/testdata/gophercolor.png.go index 21316f6..c511dd6 100644 --- a/testdata/gophercolor.png.go +++ b/testdata/gophercolor.png.go @@ -1,9 +1,9 @@ package main import ( - "io" "bytes" "compress/gzip" + "io" ) func gophercolor_png() ([]byte, error) {