|
|
|
@ -200,7 +200,7 @@ func (cfg *Config) process() (code []byte, err error) { |
|
|
|
|
opt := &imports.Options{Comments: true, TabIndent: true, TabWidth: 8} |
|
|
|
|
code, err = imports.Process("", code, opt) |
|
|
|
|
if err != nil { |
|
|
|
|
panic(fmt.Errorf("BUG: can't gofmt generated code:", err)) |
|
|
|
|
panic(fmt.Errorf("BUG: can't gofmt generated code: %v", err)) |
|
|
|
|
} |
|
|
|
|
return code, nil |
|
|
|
|
} |
|
|
|
@ -226,7 +226,7 @@ func loadPackage(cfg *Config) (*types.Package, error) { |
|
|
|
|
|
|
|
|
|
func generate(mtyp *marshalerType, cfg *Config) ([]byte, error) { |
|
|
|
|
w := new(bytes.Buffer) |
|
|
|
|
fmt.Fprintln(w, "// generated by gencodec, do not edit.\n") |
|
|
|
|
fmt.Fprint(w, "// generated by gencodec, do not edit.\n\n") |
|
|
|
|
fmt.Fprintln(w, "package", mtyp.orig.Obj().Pkg().Name()) |
|
|
|
|
fmt.Fprintln(w) |
|
|
|
|
mtyp.scope.writeImportDecl(w) |
|
|
|
|