diff --git a/internal/config/config_test.go b/internal/config/config_test.go index be84dc82f8..d643eeb9f0 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -127,6 +127,15 @@ func TestTypeOverrides(t *testing.T) { "string", true, }, + { + Override{ + DBType: "timestamp", + GoType: GoType{Spec: "time.Time"}, + }, + "time", + "time.Time", + false, + }, } { tt := test t.Run(tt.override.GoType.Spec, func(t *testing.T) { @@ -167,7 +176,7 @@ func TestTypeOverrides(t *testing.T) { t.Run(tt.override.GoType.Spec, func(t *testing.T) { err := tt.override.Parse() if err == nil { - t.Fatalf("expected pars to fail; got nil") + t.Fatalf("expected parse to fail; got nil") } if diff := cmp.Diff(tt.err, err.Error()); diff != "" { t.Errorf("error mismatch;\n%s", diff) diff --git a/internal/config/go_type.go b/internal/config/go_type.go index 9f6a24c817..7ed266a9fc 100644 --- a/internal/config/go_type.go +++ b/internal/config/go_type.go @@ -135,9 +135,6 @@ func (gt GoType) Parse() (*ParsedGoType, error) { if lastDot == -1 { 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) } - if lastSlash == -1 { - 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) - } typename = input[lastSlash+1:] // a package name beginning with "go-" will give syntax errors in // generated code. We should do the right thing and get the actual