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

Use testing.T.TempDir in the tests #54

@magnusbaeck

Description

@magnusbaeck

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions