Skip to content

Commit

Permalink
Update entc/gen/type.go
Browse files Browse the repository at this point in the history
Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
  • Loading branch information
giautm and a8m committed Apr 2, 2022
1 parent 0444141 commit b47907e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion entc/gen/type.go
Expand Up @@ -240,7 +240,7 @@ func NewType(c *Config, schema *load.Schema) (*Type, error) {
// User defined id field.
if tf.Name == typ.ID.Name {
if tf.Optional {
return nil, fmt.Errorf("id field must not be optional")
return nil, fmt.Errorf("id field cannot be optional")
}
typ.ID = tf
} else {
Expand Down
2 changes: 1 addition & 1 deletion entc/gen/type_test.go
Expand Up @@ -76,7 +76,7 @@ func TestType(t *testing.T) {
{Name: "id", Info: &field.TypeInfo{Type: field.TypeInt}, Optional: true},
},
})
require.EqualError(err, "id field must not be optional", "id field can't be optional")
require.EqualError(err, "id field cannot be optional", "id field cannot be optional")

_, err = NewType(&Config{Package: "entc/gen"}, &load.Schema{Name: "Type"})
require.EqualError(err, "schema lowercase name conflicts with Go keyword \"type\"")
Expand Down

0 comments on commit b47907e

Please sign in to comment.