Skip to content

Commit cca1dc4

Browse files
Remove an unnecessary validation check when processing type overrides for Go types. Fixes #2073 (#2078)
1 parent 5a6a606 commit cca1dc4

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

internal/config/config_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ func TestTypeOverrides(t *testing.T) {
127127
"string",
128128
true,
129129
},
130+
{
131+
Override{
132+
DBType: "timestamp",
133+
GoType: GoType{Spec: "time.Time"},
134+
},
135+
"time",
136+
"time.Time",
137+
false,
138+
},
130139
} {
131140
tt := test
132141
t.Run(tt.override.GoType.Spec, func(t *testing.T) {
@@ -167,7 +176,7 @@ func TestTypeOverrides(t *testing.T) {
167176
t.Run(tt.override.GoType.Spec, func(t *testing.T) {
168177
err := tt.override.Parse()
169178
if err == nil {
170-
t.Fatalf("expected pars to fail; got nil")
179+
t.Fatalf("expected parse to fail; got nil")
171180
}
172181
if diff := cmp.Diff(tt.err, err.Error()); diff != "" {
173182
t.Errorf("error mismatch;\n%s", diff)

internal/config/go_type.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ func (gt GoType) Parse() (*ParsedGoType, error) {
135135
if lastDot == -1 {
136136
return nil, fmt.Errorf("Package override `go_type` specifier %q is not the proper format, expected 'package.type', e.g. 'github.com/segmentio/ksuid.KSUID'", input)
137137
}
138-
if lastSlash == -1 {
139-
return nil, fmt.Errorf("Package override `go_type` specifier %q is not the proper format, expected 'package.type', e.g. 'github.com/segmentio/ksuid.KSUID'", input)
140-
}
141138
typename = input[lastSlash+1:]
142139
// a package name beginning with "go-" will give syntax errors in
143140
// generated code. We should do the right thing and get the actual

0 commit comments

Comments
 (0)