1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-11-06 08:59:18 +02:00

chore(cmd): use t.Cleanup (#2537)

This commit is contained in:
180909
2022-11-24 19:12:42 +08:00
committed by GitHub
parent a7bae93ee0
commit c530d63e75

View File

@@ -18,8 +18,6 @@ func TestModulePath(t *testing.T) {
t.Fatal(err)
}
defer os.RemoveAll("/tmp/test_mod")
f, err := os.Create("/tmp/test_mod/go.mod")
if err != nil {
t.Fatal(err)
@@ -38,6 +36,8 @@ go 1.16`
t.Fatal(err)
}
if p != "github.com/go-kratos/kratos/v2" {
t.Fatalf("want: %s, got: %s", "module github.com/go-kratos/kratos/v2", p)
t.Fatalf("want: %s, got: %s", "github.com/go-kratos/kratos/v2", p)
}
t.Cleanup(func() { os.RemoveAll("/tmp/test_mod") })
}