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

pull/2540/head
180909 2 years ago committed by GitHub
parent a7bae93ee0
commit c530d63e75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cmd/kratos/internal/base/mod_test.go

@ -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") })
}

Loading…
Cancel
Save