diff --git a/entc/gen/type.go b/entc/gen/type.go index 1f2b521bf7..2ac5461abd 100644 --- a/entc/gen/type.go +++ b/entc/gen/type.go @@ -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 { diff --git a/entc/gen/type_test.go b/entc/gen/type_test.go index 032f9fad76..89a04ac104 100644 --- a/entc/gen/type_test.go +++ b/entc/gen/type_test.go @@ -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\"")