Fixes formatting of various generated outputs to be

more compatible with `go fmt`. This partially addresses
issue #34

Signed-off-by: Jim Teeuwen <jimteeuwen@gmail.com>
This commit is contained in:
Jim Teeuwen 2014-05-28 14:43:02 +02:00
parent 394d5b27c0
commit 17800c65a0
3 changed files with 23 additions and 24 deletions

View File

@ -52,14 +52,14 @@ func bindata_read(path, name string) ([]byte, error) {
// A debug entry is simply a function which reads the asset from // A debug entry is simply a function which reads the asset from
// the original file (e.g.: from disk). // the original file (e.g.: from disk).
func writeDebugAsset(w io.Writer, asset *Asset) error { func writeDebugAsset(w io.Writer, asset *Asset) error {
_, err := fmt.Fprintf(w, ` _, err := fmt.Fprintf(w, `// %s reads file data from disk. It returns an error on failure.
// %s reads file data from disk. It returns an error on failure.
func %s() ([]byte, error) { func %s() ([]byte, error) {
return bindata_read( return bindata_read(
%q, %q,
%q, %q,
) )
} }
`, asset.Func, asset.Func, asset.Path, asset.Name) `, asset.Func, asset.Func, asset.Path, asset.Name)
return err return err
} }

View File

@ -76,13 +76,13 @@ func writeReleaseAsset(w io.Writer, c *Config, asset *Asset) error {
func header_compressed_nomemcopy(w io.Writer) error { func header_compressed_nomemcopy(w io.Writer) error {
_, err := fmt.Fprintf(w, `import ( _, err := fmt.Fprintf(w, `import (
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"fmt" "fmt"
"io" "io"
"reflect" "reflect"
"strings" "strings"
"unsafe" "unsafe"
) )
func bindata_read(data, name string) ([]byte, error) { func bindata_read(data, name string) ([]byte, error) {
@ -116,11 +116,11 @@ func bindata_read(data, name string) ([]byte, error) {
func header_compressed_memcopy(w io.Writer) error { func header_compressed_memcopy(w io.Writer) error {
_, err := fmt.Fprintf(w, `import ( _, err := fmt.Fprintf(w, `import (
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"fmt" "fmt"
"io" "io"
"strings" "strings"
) )
func bindata_read(data []byte, name string) ([]byte, error) { func bindata_read(data []byte, name string) ([]byte, error) {
@ -146,10 +146,10 @@ func bindata_read(data []byte, name string) ([]byte, error) {
func header_uncompressed_nomemcopy(w io.Writer) error { func header_uncompressed_nomemcopy(w io.Writer) error {
_, err := fmt.Fprintf(w, `import ( _, err := fmt.Fprintf(w, `import (
"fmt" "fmt"
"reflect" "reflect"
"strings" "strings"
"unsafe" "unsafe"
) )
func bindata_read(data, name string) ([]byte, error) { func bindata_read(data, name string) ([]byte, error) {
@ -169,8 +169,8 @@ func bindata_read(data, name string) ([]byte, error) {
func header_uncompressed_memcopy(w io.Writer) error { func header_uncompressed_memcopy(w io.Writer) error {
_, err := fmt.Fprintf(w, `import ( _, err := fmt.Fprintf(w, `import (
"fmt" "fmt"
"strings" "strings"
) )
`) `)
return err return err
@ -220,7 +220,7 @@ func compressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error {
} }
_, err = fmt.Fprintf(w, ` _, err = fmt.Fprintf(w, `
}, },
%q, %q,
) )
} }

5
toc.go
View File

@ -28,8 +28,7 @@ func writeTOC(w io.Writer, toc []Asset) error {
// writeTOCHeader writes the table of contents file header. // writeTOCHeader writes the table of contents file header.
func writeTOCHeader(w io.Writer) error { func writeTOCHeader(w io.Writer) error {
_, err := fmt.Fprintf(w, ` _, err := fmt.Fprintf(w, `// Asset loads and returns the asset for the given name.
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or // It returns an error if the asset could not be found or
// could not be loaded. // could not be loaded.
func Asset(name string) ([]byte, error) { func Asset(name string) ([]byte, error) {
@ -50,7 +49,7 @@ func AssetNames() []string {
} }
// _bindata is a table, holding each asset generator, mapped to its name. // _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string] func() ([]byte, error) { var _bindata = map[string]func() ([]byte, error){
`) `)
return err return err
} }