alibaba / git-repo-go

git-repo is a command-line tool for centralized workflow, can work with Gerrit, AGit-Flow compatible servers. It is written in Golang, and it can be installed easily without further dependency. It provides an easy-to-use solution for multiple repositories which is introduced by Android repo first, and it can also work with a single repository.
https://git-repo.info/
Apache License 2.0
262 stars 60 forks source link

Use testing.T.TempDir in the tests #54

Open magnusbaeck opened 1 year ago

magnusbaeck commented 1 year ago

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

https://github.com/alibaba/git-repo-go/blob/8d46bab638d4c8ca2794ae5b91fa5312d12778ab/manifest/manifest_test.go#L513-L519

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 commented 1 year ago

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