mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
cmd/ent: Add check that model file doesn't already exist on ent init (#2307)
Previously if you run it would overwrite an existing file if that already existed. Now checks if that file already exists, and returns an error if so.
This commit is contained in:
@@ -19,6 +19,8 @@ func TestCmd(t *testing.T) {
|
||||
stderr := bytes.NewBuffer(nil)
|
||||
cmd.Stderr = stderr
|
||||
require.NoError(t, cmd.Run(), stderr.String())
|
||||
cmd = exec.Command("go", "run", "entgo.io/ent/cmd/ent", "init", "User")
|
||||
require.Error(t, cmd.Run())
|
||||
|
||||
_, err := os.Stat("ent/generate.go")
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user