fix: panic on test.db rm err

This commit is contained in:
Florian Sylvain
2023-08-12 02:39:42 +02:00
parent 46daadb8e4
commit 542bcded3e
2 changed files with 1 additions and 9 deletions
+1 -8
View File
@@ -16,10 +16,6 @@ var ApiUrl string
var AuthorizationCookie *http.Cookie
var HttpClient = http.Client{}
func DeleteTestDb() error {
return os.Remove("test.db")
}
func GetDb() *gorm.DB {
db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})
if err != nil {
@@ -34,10 +30,7 @@ func StartServerIfNotAlready() {
if err == nil {
return
}
err = DeleteTestDb()
if err != nil {
panic(err)
}
_ = os.Remove("test.db")
go func(url *string) {
router := server.InitServer()
*url = "http://localhost:" + os.Getenv("PORT") + "/v1"