Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Use testing.T.TempDir in the tests #54

Open
magnusbaeck opened this issue Oct 21, 2022 · 1 comment
Open

Use testing.T.TempDir in the tests #54

magnusbaeck opened this issue Oct 21, 2022 · 1 comment

Comments

@magnusbaeck
Copy link

We can clean up the tests a bit by starting to use testing.T.TempDir instead of having this in ~20 tests:

tmpdir, err := ioutil.TempDir("", "git-repo")
if err != nil {
log.Fatal(err)
}
defer func(dir string) {
os.RemoveAll(dir)
}(tmpdir)

I would normally just have sent a PR, but testing.T.TempDir was introduced in Go 1.15 and I don't know whether it would be okay to require that compiler version given that go.mod states 1.12 and that .github/workflows/go.yml uses Go 1.14 on Mac OS X. Is there any particular reason Mac OS X builds use an older version than what's tested on Linux?

@jiangxin
Copy link
Collaborator

Thanks @magnusbaeck , we can upgrade Golang to 1.15 or above. Please send a PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants