Skip to content

Commit b6ba7bc

Browse files
committed
type name and file name should not have pointer
resolves #63
1 parent 2c662d8 commit b6ba7bc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

typewriter/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (a *app) WriteAll() error {
9191
var b bytes.Buffer
9292
write(&b, a, t, tw)
9393
// will append _test to file name if the source type is in a _test.go file
94-
f := strings.ToLower(fmt.Sprintf("%s_%s%s.go", t.LocalName(), tw.Name(), t.test))
94+
f := strings.ToLower(fmt.Sprintf("%s_%s%s.go", t.Name, tw.Name(), t.test))
9595
buffers[f] = &b
9696
}
9797
}

typewriter/package.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package typewriter
33
import (
44
"go/ast"
55
"go/token"
6+
"strings"
67

78
_ "code.google.com/p/go.tools/go/gcimporter"
89
"code.google.com/p/go.tools/go/types"
@@ -43,7 +44,7 @@ func (p *Package) Eval(name string) (result Type, err error) {
4344
result = Type{
4445
Package: p,
4546
Pointer: isPointer(t),
46-
Name: name,
47+
Name: strings.TrimLeft(name, Pointer(true).String()), // trims the * if it exists
4748
comparable: isComparable(t),
4849
numeric: isNumeric(t),
4950
ordered: isOrdered(t),

0 commit comments

Comments
 (0)