Skip to content

Commit

Permalink
Merge 3e423bc into 9e6edb9
Browse files Browse the repository at this point in the history
  • Loading branch information
argouber committed Aug 28, 2019
2 parents 9e6edb9 + 3e423bc commit 98ecfff
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion codegen/header_propagate.go
Expand Up @@ -147,7 +147,7 @@ func (hp *HeaderPropagator) initNilOpt(path string, toFields []*compile.FieldSpe
return err
}
ftype := f.Type
t, err := goCustomType(hp.Helper, ftype)
t, err := GoCustomType(hp.Helper, ftype)
if err != nil {
return errors.Wrapf(
err,
Expand Down
2 changes: 1 addition & 1 deletion codegen/package_test.go
Expand Up @@ -137,5 +137,5 @@ func TestGoCustomTypeError(t *testing.T) {
spec := &compile.StructSpec{}
_, err := h.TypeFullName(spec)
assert.Error(t, err)
assert.Equal(t, "goCustomType called with native type (*compile.StructSpec) &{false 0 [] map[]}", err.Error())
assert.Equal(t, "GoCustomType called with native type (*compile.StructSpec) &{false 0 [] map[]}", err.Error())
}
8 changes: 4 additions & 4 deletions codegen/thrift.go
Expand Up @@ -75,7 +75,7 @@ func GoType(p PackageNameResolver, spec compile.TypeSpec) (string, error) {
}
return fmt.Sprintf("map[%s]struct{}", v), nil
case *compile.EnumSpec, *compile.StructSpec, *compile.TypedefSpec:
return goCustomType(p, spec)
return GoCustomType(p, spec)
default:
panic(fmt.Sprintf("Unknown type (%T) for %s", spec, spec.ThriftName()))
}
Expand All @@ -97,11 +97,11 @@ func GoReferenceType(p PackageNameResolver, spec compile.TypeSpec) (string, erro
return t, nil
}

// goCustomType returns the user-defined Go type with its importing package.
func goCustomType(p PackageNameResolver, spec compile.TypeSpec) (string, error) {
// GoCustomType returns the user-defined Go type with its importing package.
func GoCustomType(p PackageNameResolver, spec compile.TypeSpec) (string, error) {
f := spec.ThriftFile()
if f == "" {
return "", fmt.Errorf("goCustomType called with native type (%T) %v", spec, spec)
return "", fmt.Errorf("GoCustomType called with native type (%T) %v", spec, spec)
}

pkg, err := p.TypePackageName(f)
Expand Down
10 changes: 5 additions & 5 deletions codegen/thrift_test.go
Expand Up @@ -73,7 +73,7 @@ func TestCustomTypeError(t *testing.T) {
typ, err := codegen.GoType(p, es)
assert.Equal(t, "", typ)
assert.Error(t, err)
assert.Contains(t, err.Error(), "goCustomType called with native type (*compile.EnumSpec)")
assert.Contains(t, err.Error(), "GoCustomType called with native type (*compile.EnumSpec)")
}

func TestCustomTypeInListError(t *testing.T) {
Expand All @@ -86,7 +86,7 @@ func TestCustomTypeInListError(t *testing.T) {
typ, err := codegen.GoType(p, es)
assert.Equal(t, "", typ)
assert.Error(t, err)
assert.Contains(t, err.Error(), "goCustomType called with native type (*compile.StructSpec)")
assert.Contains(t, err.Error(), "GoCustomType called with native type (*compile.StructSpec)")
}

func TestCustomTypeInSetError(t *testing.T) {
Expand All @@ -99,7 +99,7 @@ func TestCustomTypeInSetError(t *testing.T) {
typ, err := codegen.GoType(p, es)
assert.Equal(t, "", typ)
assert.Error(t, err)
assert.Contains(t, err.Error(), "goCustomType called with native type (*compile.TypedefSpec)")
assert.Contains(t, err.Error(), "GoCustomType called with native type (*compile.TypedefSpec)")
}

func TestCustomTypeAsMapKeyError(t *testing.T) {
Expand All @@ -112,7 +112,7 @@ func TestCustomTypeAsMapKeyError(t *testing.T) {
typ, err := codegen.GoType(p, es)
assert.Equal(t, "", typ)
assert.Error(t, err)
assert.Contains(t, err.Error(), "goCustomType called with native type (*compile.TypedefSpec)")
assert.Contains(t, err.Error(), "GoCustomType called with native type (*compile.TypedefSpec)")
}

func TestCustomTypeAsMapValueError(t *testing.T) {
Expand All @@ -126,5 +126,5 @@ func TestCustomTypeAsMapValueError(t *testing.T) {
typ, err := codegen.GoType(p, es)
assert.Equal(t, "", typ)
assert.Error(t, err)
assert.Contains(t, err.Error(), "goCustomType called with native type (*compile.TypedefSpec)")
assert.Contains(t, err.Error(), "GoCustomType called with native type (*compile.TypedefSpec)")
}
2 changes: 1 addition & 1 deletion codegen/type_converter.go
Expand Up @@ -149,7 +149,7 @@ func convertIdentifiersToNilChecks(identifiers []string) []string {
}

func (c *TypeConverter) getIdentifierName(fieldType compile.TypeSpec) (string, error) {
t, err := goCustomType(c.Helper, fieldType)
t, err := GoCustomType(c.Helper, fieldType)
if err != nil {
return "", errors.Wrapf(
err,
Expand Down

0 comments on commit 98ecfff

Please sign in to comment.